Skip to content

Build your personal knowledge base with Trilium Notes

test(data_dir): fix flaky getPlatformAppDataDir test on Windows

Panagiotis Papadopoulosca8146413a81
diff --git a/src/services/data_dir.spec.ts b/src/services/data_dir.spec.ts
index 37958b1851..4c94cbe940 100644
--- a/src/services/data_dir.spec.ts
+++ b/src/services/data_dir.spec.ts
@@ -77,6 +77,11 @@ describe("data_dir.ts unit tests", async () => {
["w/ darwin it should return '~/Library/Application Support'", ["darwin", undefined], "/Users/mock/Library/Application Support", "/Users/mock"]
];
+ beforeEach(() => {
+ // make sure OS does not set its own process.env.APPDATA, so that we can use our own supplied value
+ delete process.env.APPDATA;
+ });
+
testCases.forEach((testCase) => {
const [testDescription, fnValues, expected, osHomedirMockValue] = testCase;
return it(testDescription, () => {