|
1 | 1 | import{fireEvent,screen,waitFor}from"@testing-library/react"
|
2 | 2 | importuserEventfrom"@testing-library/user-event"
|
3 |
| -importEventSourcefrom"eventsourcemock" |
| 3 | +importEventSourceMockfrom"eventsourcemock" |
4 | 4 | importi18nextfrom"i18next"
|
5 | 5 | import{rest}from"msw"
|
6 | 6 | import*asapifrom"../../api/api"
|
@@ -70,13 +70,20 @@ const testStatus = async (ws: Workspace, label: string) => {
|
70 | 70 | expect(status).toHaveTextContent(label)
|
71 | 71 | }
|
72 | 72 |
|
| 73 | +letoriginalEventSource:typeofwindow.EventSource |
| 74 | + |
| 75 | +beforeAll(()=>{ |
| 76 | +originalEventSource=window.EventSource |
| 77 | +// mocking out EventSource for SSE |
| 78 | +window.EventSource=EventSourceMock |
| 79 | +}) |
| 80 | + |
73 | 81 | beforeEach(()=>{
|
74 | 82 | jest.resetAllMocks()
|
| 83 | +}) |
75 | 84 |
|
76 |
| -// mocking out EventSource for SSE |
77 |
| -Object.defineProperty(window,"EventSource",{ |
78 |
| -value:EventSource, |
79 |
| -}) |
| 85 | +afterAll(()=>{ |
| 86 | +window.EventSource=originalEventSource |
80 | 87 | })
|
81 | 88 |
|
82 | 89 | describe("WorkspacePage",()=>{
|
|