@fetch-mock/jest
Version:
jest wrapper for fetch-mock
13 lines (10 loc) • 365 B
text/typescript
import './custom-jsdom-environment';
import fetchMock from '../index';
import { describe, it, expect } from '@jest/globals';
fetchMock.mockGlobal().get('http://example.com', { status: 418 });
describe('compatibility with jsdom', () => {
it('can fetch stuff', async () => {
const r = await fetch('http://example.com');
expect(r.status).toEqual(418);
});
});