test(services/data_dir): make test descriptions a bit more readable

This commit is contained in:
Panagiotis Papadopoulos 2025-01-18 12:46:38 +01:00
parent 31fb8eb3d3
commit dba0ef4945

View File

@ -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";