Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit94db085

Browse files
authored
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
1 parent4e57b9f commit94db085

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

‎.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"drpcserver",
2626
"Dsts",
2727
"enablements",
28+
"eventsourcemock",
2829
"fatih",
2930
"Formik",
3031
"gitsshkey",

‎site/src/pages/UsersPage/UsersPage.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-floating-promises */
21
import{fireEvent,screen,waitFor,within}from"@testing-library/react"
32
importuserEventfrom"@testing-library/user-event"
43
import{i18n}from"i18n"
@@ -428,8 +427,7 @@ describe("UsersPage", () => {
428427
}),
429428
)
430429

431-
// eslint-disable-next-line @typescript-eslint/no-empty-function
432-
awaitupdateUserRole(()=>{},MockAuditorRole)
430+
awaitupdateUserRole(()=>null,MockAuditorRole)
433431

434432
// Check if the error message is displayed
435433
consterrorMessage=awaitscreen.findByText("message from the backend")

‎site/src/pages/WorkspacePage/WorkspacePage.test.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-floating-promises */
22
import{fireEvent,screen,waitFor}from"@testing-library/react"
33
importuserEventfrom"@testing-library/user-event"
4-
importEventSourcefrom"eventsourcemock"
4+
importEventSourceMockfrom"eventsourcemock"
55
importi18nextfrom"i18next"
66
import{rest}from"msw"
77
import*asapifrom"../../api/api"
@@ -75,13 +75,20 @@ const testStatus = async (ws: Workspace, label: string) => {
7575
expect(status).toHaveTextContent(label)
7676
}
7777

78+
letoriginalEventSource:typeofwindow.EventSource
79+
80+
beforeAll(()=>{
81+
originalEventSource=window.EventSource
82+
// mocking out EventSource for SSE
83+
window.EventSource=EventSourceMock
84+
})
85+
7886
beforeEach(()=>{
7987
jest.resetAllMocks()
88+
})
8089

81-
// mocking out EventSource for SSE
82-
Object.defineProperty(window,"EventSource",{
83-
value:EventSource,
84-
})
90+
afterAll(()=>{
91+
window.EventSource=originalEventSource
8592
})
8693

8794
describe("WorkspacePage",()=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp