Skip to content

Commit cb429dd

Browse files
committed
test: add failing test for failure to spy in browsers
1 parent 70a7f2d commit cb429dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/fetch-mock/src/__tests__/FetchMock/mock-and-spy.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('mock and spy', () => {
5959
describe('.spy()', () => {
6060
testChainableMethod('spy');
6161
testChainableMethod('spyGlobal');
62+
6263
it('passes all requests through to the network by default', async () => {
6364
vi.spyOn(fm.config, 'fetch');
6465
fm.spy();
@@ -134,5 +135,12 @@ describe('mock and spy', () => {
134135
method: 'post',
135136
});
136137
});
138+
139+
it('can call actual native fetch without erroring', async () => {
140+
fm.spyGlobal();
141+
await expect(
142+
fm.fetchHandler('http://example.com/'),
143+
).resolves.toBeInstanceOf(Response);
144+
});
137145
});
138146
});

0 commit comments

Comments
 (0)