Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jan 30, 2024
1 parent cf272a8 commit 2e4db4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/backend/src/managers/playground.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ test('startPlayground should download image if not present then create container
},
Image: 'image1',
Labels: {
'ia-studio-model': 'model1',
'ai-studio-model-id': 'model1',
'ai-studio-model-port': '8085',
},
});
});
Expand Down
8 changes: 8 additions & 0 deletions packages/backend/src/studio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const mockedExtensionContext = {

const studio = new Studio(mockedExtensionContext);

const mocks = vi.hoisted(() => ({
listContainers: vi.fn(),
}));

vi.mock('@podman-desktop/api', async () => {
return {
Uri: class {
Expand All @@ -46,6 +50,9 @@ vi.mock('@podman-desktop/api', async () => {
},
}),
},
containerEngine: {
listContainers: mocks.listContainers,
},
};
});

Expand All @@ -63,6 +70,7 @@ afterEach(() => {
});

test('check activate ', async () => {
mocks.listContainers.mockReturnValue([]);
vi.spyOn(fs.promises, 'readFile').mockImplementation(() => {
return Promise.resolve('<html></html>');
});
Expand Down

0 comments on commit 2e4db4a

Please sign in to comment.