test(data_dir): fix flaky getPlatformAppDataDir test on Windows

Delete the provided process.env.APPDATA on Windows, so that we can use our own values (one of which is "undefined", which was causing the getPlatformAppDataDir to fallback to the "real" process.env.APPDATA
-> causing failing test, when run on Windows
This commit is contained in:
Panagiotis Papadopoulos 2025-01-20 18:57:43 +01:00
parent 7f15f8a7de
commit ca8146413a

View File

@ -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, () => {