|
1 | | -import { rest } from 'msw' |
| 1 | +import { http, HttpResponse } from 'msw' |
2 | 2 | import { faker } from '@faker-js/faker' |
3 | 3 | import { |
4 | | - CommandExecution, |
5 | 4 | CommandExecutionType, |
6 | 5 | CommandExecutionUI, |
7 | 6 | ResultsMode, |
@@ -251,12 +250,11 @@ describe('CommandsHistoryIndexedDB', () => { |
251 | 250 |
|
252 | 251 | // Override the MSW handler to return our mock commands |
253 | 252 | mswServer.use( |
254 | | - rest.post<CommandExecution[]>( |
| 253 | + http.post( |
255 | 254 | getMswURL( |
256 | 255 | getUrl(mockInstanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), |
257 | 256 | ), |
258 | | - async (_req, res, ctx) => |
259 | | - res(ctx.status(200), ctx.json(mockCommandExecutions)), |
| 257 | + async () => HttpResponse.json(mockCommandExecutions, { status: 200 }), |
260 | 258 | ), |
261 | 259 | ) |
262 | 260 |
|
@@ -284,11 +282,11 @@ describe('CommandsHistoryIndexedDB', () => { |
284 | 282 |
|
285 | 283 | // Override the MSW handler to return an error status |
286 | 284 | mswServer.use( |
287 | | - rest.post<CommandExecution[]>( |
| 285 | + http.post( |
288 | 286 | getMswURL( |
289 | 287 | getUrl(mockInstanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), |
290 | 288 | ), |
291 | | - async (_req, res, ctx) => res(ctx.status(statusCode)), |
| 289 | + async () => HttpResponse.text('', { status: statusCode }), |
292 | 290 | ), |
293 | 291 | ) |
294 | 292 |
|
@@ -318,11 +316,11 @@ describe('CommandsHistoryIndexedDB', () => { |
318 | 316 |
|
319 | 317 | // Override the MSW handler to simulate a network error |
320 | 318 | mswServer.use( |
321 | | - rest.post<CommandExecution[]>( |
| 319 | + http.post( |
322 | 320 | getMswURL( |
323 | 321 | getUrl(mockInstanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), |
324 | 322 | ), |
325 | | - async (_req, res) => res.networkError(mockError), |
| 323 | + async () => HttpResponse.error(), |
326 | 324 | ), |
327 | 325 | ) |
328 | 326 |
|
|
0 commit comments