From dba0ef4945b01c3a565146fd3cb5d25dc760766f Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Sat, 18 Jan 2025 12:46:38 +0100 Subject: [PATCH] test(services/data_dir): make test descriptions a bit more readable --- spec-es6/data_dir.spec.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spec-es6/data_dir.spec.ts b/spec-es6/data_dir.spec.ts index be16b9bea..81e9bc501 100644 --- a/spec-es6/data_dir.spec.ts +++ b/spec-es6/data_dir.spec.ts @@ -140,8 +140,15 @@ describe("data_dir.ts unit tests", async () => { resetAllMocks(); }); + /** + * case A – process.env.TRILIUM_DATA_DIR is set + * case B – process.env.TRILIUM_DATA_DIR is not set and Trilium folder is existing in platform + * case C – process.env.TRILIUM_DATA_DIR is not set and Trilium folder is not existing in platform's home dir + * case D – fallback to creating Trilium folder in home dir + */ - describe("case A – process.env.TRILIUM_DATA_DIR is set", () => { + + describe("case A", () => { it("when folder exists – it should return the path, without attempting to create the folder", async () => { const mockTriliumDataPath = "/home/mock/trilium-data-ENV-A1"; process.env.TRILIUM_DATA_DIR = mockTriliumDataPath; @@ -175,7 +182,7 @@ describe("data_dir.ts unit tests", async () => { }); }); - describe("case B – process.env.TRILIUM_DATA_DIR is not set and Trilium folder is existing in platform's home dir", () => { + describe("case B", () => { it("it should check if folder exists and return it", async () => { const homedir = "/home/mock"; const dataDirName = "trilium-data"; @@ -193,7 +200,7 @@ describe("data_dir.ts unit tests", async () => { }); }); - describe("case C – process.env.TRILIUM_DATA_DIR is not set and Trilium folder is not existing in platform's home dir", () => { + describe("case C", () => { it("w/ Platform 'Linux', an existing App Data Folder (~/.local/share) but non-existing Trilium dir (~/.local/share/trilium-data) – it should attempt to create the dir", async () => { const homedir = "/home/mock"; const dataDirName = "trilium-data"; @@ -278,7 +285,7 @@ describe("data_dir.ts unit tests", async () => { }); }); - describe("case D – fallback to creating Trilium folder in home dir", () => { + describe("case D", () => { it("w/ unknown PlatformAppDataDir it should attempt to create the folder in the homefolder", async () => { const homedir = "/home/mock"; const dataDirName = "trilium-data";