'import { rest } from 'msw' TypeError: __extends is not a function
I don't know where I went wrong, but when I import msw I have an error __extends is not a function
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import { APIComponent } from '../eee';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
const response = rest.get('/api', (req, res, ctx) => {
return res(ctx.json({ name: 'Jack' }));
});
const handlers = [response];
const server = setupServer(...handlers);
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
test('gets the data', async () => {
render(<APIComponent />);
const out = await waitFor(() => screen.findAllByRole('contentinfo'));
expect(out).toHaveTextContent('Name is Jack');
});
I do not know what to do
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|