mirror of https://github.com/coder/coder.git
chore(site): remove some eslint-disables (#4265)
* fix: await promises in WorkspacePage.test.tsx * chore: add eventsourcemock to cspell words * fix: clean up UsersPage.test.tsx * refactor: clean up eventsource mock * revert: remove changes from WorkspacePage.test.tsx
This commit is contained in:
parent
4e57b9fbdc
commit
94db085b51
|
@ -25,6 +25,7 @@
|
|||
"drpcserver",
|
||||
"Dsts",
|
||||
"enablements",
|
||||
"eventsourcemock",
|
||||
"fatih",
|
||||
"Formik",
|
||||
"gitsshkey",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { fireEvent, screen, waitFor, within } from "@testing-library/react"
|
||||
import userEvent from "@testing-library/user-event"
|
||||
import { i18n } from "i18n"
|
||||
|
@ -428,8 +427,7 @@ describe("UsersPage", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
await updateUserRole(() => {}, MockAuditorRole)
|
||||
await updateUserRole(() => null, MockAuditorRole)
|
||||
|
||||
// Check if the error message is displayed
|
||||
const errorMessage = await screen.findByText("message from the backend")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { fireEvent, screen, waitFor } from "@testing-library/react"
|
||||
import userEvent from "@testing-library/user-event"
|
||||
import EventSource from "eventsourcemock"
|
||||
import EventSourceMock from "eventsourcemock"
|
||||
import i18next from "i18next"
|
||||
import { rest } from "msw"
|
||||
import * as api from "../../api/api"
|
||||
|
@ -75,13 +75,20 @@ const testStatus = async (ws: Workspace, label: string) => {
|
|||
expect(status).toHaveTextContent(label)
|
||||
}
|
||||
|
||||
let originalEventSource: typeof window.EventSource
|
||||
|
||||
beforeAll(() => {
|
||||
originalEventSource = window.EventSource
|
||||
// mocking out EventSource for SSE
|
||||
window.EventSource = EventSourceMock
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks()
|
||||
})
|
||||
|
||||
// mocking out EventSource for SSE
|
||||
Object.defineProperty(window, "EventSource", {
|
||||
value: EventSource,
|
||||
})
|
||||
afterAll(() => {
|
||||
window.EventSource = originalEventSource
|
||||
})
|
||||
|
||||
describe("WorkspacePage", () => {
|
||||
|
|
Loading…
Reference in New Issue