Skip to content

Upgrade frontend to React 18 #3353

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 20 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Wait for permissions too be loaded as well
  • Loading branch information
BrunoQuaresma committed Aug 19, 2022
commit a5dc0900aff1edf25525ca099b09026c2deb248c
42 changes: 22 additions & 20 deletions site/src/pages/WorkspacePage/WorkspacePage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fireEvent, screen, waitFor } from "@testing-library/react"
import { fireEvent, screen, waitFor, within } from "@testing-library/react"
import { rest } from "msw"
import * as api from "../../api/api"
import { Workspace } from "../../api/typesGenerated"
Expand Down Expand Up @@ -82,25 +82,27 @@ describe("WorkspacePage", () => {
.mockResolvedValueOnce(MockWorkspaceBuild)
testButton(Language.stop, stopWorkspaceMock)
})
// it("requests a delete job when the user presses Delete and confirms", async () => {
// const deleteWorkspaceMock = jest
// .spyOn(api, "deleteWorkspace")
// .mockResolvedValueOnce(MockWorkspaceBuild)
// await renderWorkspacePage()
//
// // open the workspace action popover so we have access to all available ctas
// const trigger = await screen.findByTestId("workspace-actions-button")
// fireEvent.click(trigger)
//
// const button = await screen.findByText(Language.delete)
// fireEvent.click(button)
//
// const confirmDialog = await screen.findByRole("dialog")
// const confirmButton = within(confirmDialog).getByText("Delete")
//
// fireEvent.click(confirmButton)
// expect(deleteWorkspaceMock).toBeCalled()
// })

it("requests a delete job when the user presses Delete and confirms", async () => {
const deleteWorkspaceMock = jest
.spyOn(api, "deleteWorkspace")
.mockResolvedValueOnce(MockWorkspaceBuild)
await renderWorkspacePage()

// open the workspace action popover so we have access to all available ctas
const trigger = await screen.findByTestId("workspace-actions-button")
fireEvent.click(trigger)

const button = await screen.findByText(Language.delete)
fireEvent.click(button)

const confirmDialog = await screen.findByRole("dialog")
const confirmButton = within(confirmDialog).getByText("Delete")

fireEvent.click(confirmButton)
expect(deleteWorkspaceMock).toBeCalled()
})

it("requests a start job when the user presses Start", async () => {
server.use(
rest.get(`/api/v2/users/:userId/workspace/:workspaceName`, (req, res, ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacePage/WorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const WorkspacePage: React.FC = () => {
{checkPermissionsError ? <ErrorSummary error={checkPermissionsError} /> : <></>}
</div>
)
} else if (!workspace) {
} else if (!workspace || !permissions) {
return <FullScreenLoader />
} else {
const favicon = getFaviconByStatus(workspace.latest_build)
Expand Down