From be07dd41d1430f21aef5338cff98cb0ac35ef949 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Mon, 22 Jan 2024 17:32:13 +0100 Subject: [PATCH] tests: fix windows paths --- .../backend/src/managers/applicationManager.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/managers/applicationManager.spec.ts b/packages/backend/src/managers/applicationManager.spec.ts index 7e6d913a8..04321edd4 100644 --- a/packages/backend/src/managers/applicationManager.spec.ts +++ b/packages/backend/src/managers/applicationManager.spec.ts @@ -22,7 +22,11 @@ vi.mock('../models/AIConfig', () => ({ test('appUserDirectory should be under home directory', () => { vi.spyOn(os, 'homedir').mockReturnValue('/home/user'); const manager = new ApplicationManager({} as GitManager, {} as RecipeStatusRegistry, {} as ExtensionContext); - expect(manager.appUserDirectory).toMatch(/^(\/|\\)home(\/|\\)user/); + if (process.platform === 'win32') { + expect(manager.appUserDirectory).toMatch(/^\\home\\user/); + } else { + expect(manager.appUserDirectory).toMatch(/^\/home\/user/); + } }); test('getLocalModels should return models in local directory', () => { @@ -133,6 +137,10 @@ test('pullApplication should clone repository and call downloadModelMain', async url: '', }; await manager.pullApplication(recipe, model); - expect(cloneRepositoryMock).toHaveBeenNthCalledWith(1, 'repo', '/home/user/podman-desktop/ai-studio/recipe1'); + if (process.platform === 'win32') { + expect(cloneRepositoryMock).toHaveBeenNthCalledWith(1, 'repo', '\\home\\user\\podman-desktop\\ai-studio\\recipe1'); + } else { + expect(cloneRepositoryMock).toHaveBeenNthCalledWith(1, 'repo', '/home/user/podman-desktop/ai-studio/recipe1'); + } expect(downloadModelMainSpy).toHaveBeenCalledOnce(); });