diff --git a/packages/core/src/__tests__/FetchMock/mock-and-spy.test.js b/packages/core/src/__tests__/FetchMock/mock-and-spy.test.js index 2793960f..06ac1746 100644 --- a/packages/core/src/__tests__/FetchMock/mock-and-spy.test.js +++ b/packages/core/src/__tests__/FetchMock/mock-and-spy.test.js @@ -27,10 +27,12 @@ describe('mock and spy', () => { testChainableMethod('mockGlobal'); testChainableMethod('unmockGlobal'); - it('replaces global fetch with fetchMock.fetchHandler', () => { + it('replaces global fetch with fetchMock.fetchHandler', async () => { vi.spyOn(fm, 'fetchHandler'); fm.mockGlobal(); - fetch('http://a.com', { method: 'post' }); + try { + await fetch('http://a.com', { method: 'post' }); + } catch (err) {} // cannot just check globalThis.fetch === fm.fetchHandler because we apply .bind() to fetchHandler expect(fm.fetchHandler).toHaveBeenCalledWith('http://a.com', { method: 'post',