MSW: Bump msw from 1.2.3 to 2.3.1
This bumps Mock Service Worker and updates the handlers.
This commit is contained in:
parent
a8c8942af6
commit
501323b476
6 changed files with 484 additions and 359 deletions
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
|||
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
import { MockedRequest } from 'msw';
|
||||
|
||||
import ImageWizard from '../../../Components/CreateImageWizard';
|
||||
import { RHEL_9 } from '../../../constants';
|
||||
|
|
@ -17,7 +16,8 @@ type RequestTypes = 'GET' | 'PUT' | 'POST' | 'DELETE';
|
|||
|
||||
export function spyOnRequest(pathname: string, method: RequestTypes) {
|
||||
return new Promise((resolve) => {
|
||||
const listener = async (req: MockedRequest) => {
|
||||
// @ts-expect-error Parameter 'name' implicitly has an 'any' type.ts(7006)
|
||||
const listener = async (req) => {
|
||||
if (req.url.pathname === pathname && req.method === method) {
|
||||
const requestData = await req.clone().json();
|
||||
resolve(requestData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue