Skip to content

Commit

Permalink
test: add failing test for failure to spy in browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Jan 28, 2025
1 parent 70a7f2d commit cb429dd
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('mock and spy', () => {
describe('.spy()', () => {
testChainableMethod('spy');
testChainableMethod('spyGlobal');

it('passes all requests through to the network by default', async () => {
vi.spyOn(fm.config, 'fetch');
fm.spy();
Expand Down Expand Up @@ -134,5 +135,12 @@ describe('mock and spy', () => {
method: 'post',
});
});

it('can call actual native fetch without erroring', async () => {
fm.spyGlobal();
await expect(
fm.fetchHandler('http://example.com/'),
).resolves.toBeInstanceOf(Response);
});
});
});

0 comments on commit cb429dd

Please sign in to comment.