Skip to content

feat: add impending deletion filter to workspaces page #7860

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 18 commits into from
Jun 12, 2023
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
unstaged changes
  • Loading branch information
Kira-Pilot committed Jun 12, 2023
commit e03e443d00f5eb28e694cd336ff0c67d5381904c
4 changes: 2 additions & 2 deletions coderd/searchquery/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ func TestSearchWorkspace(t *testing.T) {
Query: "deleting_by:2023-06-09",
Expected: searchquery.PostFilter{
DeletingBy: ptr.Ref(time.Date(
2023, 06, 9, 0, 0, 0, 0, time.UTC)),
2023, 6, 9, 0, 0, 0, 0, time.UTC)),
},
},
{
Name: "MultipleParams",
Query: "deleting_by:2023-06-09 name:workspace-name",
Expected: searchquery.PostFilter{
DeletingBy: ptr.Ref(time.Date(
2023, 06, 9, 0, 0, 0, 0, time.UTC)),
2023, 6, 9, 0, 0, 0, 0, time.UTC)),
},
},
}
Expand Down
29 changes: 1 addition & 28 deletions site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { screen } from "@testing-library/react"
import { rest } from "msw"
import * as CreateDayString from "utils/createDayString"
import {
MockWorkspace,
MockWorkspacesResponse,
MockEntitlementsWithScheduling,
MockWorkspacesResponseWithDeletions,
} from "testHelpers/entities"
import { MockWorkspace, MockWorkspacesResponse } from "testHelpers/entities"
import { history, renderWithAuth } from "testHelpers/renderHelpers"
import { server } from "testHelpers/server"
import WorkspacesPage from "./WorkspacesPage"
import { i18n } from "i18n"
import * as API from "api/api"
import userEvent from "@testing-library/user-event"

const { t } = i18n

Expand Down Expand Up @@ -48,24 +41,4 @@ describe("WorkspacesPage", () => {
)
expect(templateDisplayNames).toHaveLength(MockWorkspacesResponse.count)
})

it("displays banner for impending deletions", async () => {
jest
.spyOn(API, "getEntitlements")
.mockResolvedValue(MockEntitlementsWithScheduling)

jest
.spyOn(API, "getWorkspaces")
.mockResolvedValue(MockWorkspacesResponseWithDeletions)

renderWithAuth(<WorkspacesPage />)

const banner = await screen.findByText(
"You have workspaces that will be deleted soon due to inactivity. To keep these workspaces, connect to them via SSH or the web terminal.",
)
const user = userEvent.setup()
await user.click(screen.getByTestId("dismiss-banner-btn"))

expect(banner).toBeEmptyDOMElement
})
})