Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: fix windows paths
Browse files Browse the repository at this point in the history
feloy committed Jan 22, 2024
1 parent 8f39872 commit be07dd4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/backend/src/managers/applicationManager.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});

0 comments on commit be07dd4

Please sign in to comment.