Skip to content

refactor: poll for git auth updates when creating a workspace #9804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 26, 2023
Prev Previous commit
Next Next commit
fix tests pt. 2
  • Loading branch information
aslilac committed Sep 22, 2023
commit 91665c6ee2b56c78b44790501e371bc7f24ef48d
25 changes: 25 additions & 0 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,31 @@ describe("CreateWorkspacePage", () => {
path: "/templates/:template/workspace",
});

await waitFor(() => {
expect(createWorkspaceSpy).toBeCalledWith(
MockOrganization.id,
"me",
expect.objectContaining({
template_id: MockTemplate.id,
rich_parameter_values: [{ name: param, value: paramValue }],
}),
);
});
});

it("auto create a workspace if uses mode=auto and version=version-id", async () => {
const param = "first_parameter";
const paramValue = "It works!";
const createWorkspaceSpy = jest.spyOn(API, "createWorkspace");

renderWithAuth(<CreateWorkspacePage />, {
route:
"/templates/" +
MockTemplate.name +
`/workspace?param.${param}=${paramValue}&mode=auto&version=test-template-version`,
path: "/templates/:template/workspace",
});

await waitFor(() => {
expect(createWorkspaceSpy).toBeCalledWith(
MockOrganization.id,
Expand Down