Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagerb committed Feb 13, 2025
1 parent 07af633 commit 5e192ec
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion extensions/vscode/src/state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ class mockApiClient {
list: vi.fn(),
reset: vi.fn(),
};

readonly interpreters = {
get: vi.fn(() => {
return {
data: {
dir: "/usr/proj",
r: "/usr/bin/r",
python: "/usr/bin/python",
},
};
}),
};
}

const mockClient = new mockApiClient();
Expand Down Expand Up @@ -61,9 +73,14 @@ vi.mock("vscode", () => {
showInformationMessage: vi.fn(),
};

const workspaceStateMock = {
get: vi.fn(),
};

return {
Disposable: disposableMock,
window: windowMock,
workspace: workspaceStateMock,
};
});

Expand Down Expand Up @@ -249,11 +266,12 @@ describe("PublisherState", () => {
const contentRecordState: DeploymentSelectorState =
selectionStateFactory.build();

const { mockContext } = mkExtensionContextStateMock({});
const { mockContext, mockWorkspace } = mkExtensionContextStateMock({});
const publisherState = new PublisherState(mockContext);

// No config get due to no content record set
let currentConfig = await publisherState.getSelectedConfiguration();
expect(mockWorkspace.get).toHaveBeenCalled();
expect(currentConfig).toEqual(undefined);
expect(mockClient.configurations.get).not.toHaveBeenCalled();

Expand Down

0 comments on commit 5e192ec

Please sign in to comment.