Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

fix(graphcache): use vi.stubGlobal for navigator mock in tests (#3838)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

authored by

Jacek Tomaszewski
Claude Opus 4.5
and committed by
GitHub
058a07c3 1d0ce5c1

+6 -2
+6 -2
exchanges/graphcache/src/offlineExchange.test.ts
··· 5 5 Operation, 6 6 OperationResult, 7 7 } from '@urql/core'; 8 - import { vi, expect, it, describe, beforeAll } from 'vitest'; 8 + import { vi, expect, it, describe, beforeAll, afterAll } from 'vitest'; 9 9 10 10 import { pipe, share, map, makeSubject, tap, publish } from 'wonka'; 11 11 import { queryResponse } from '../../../packages/core/src/test-utils'; ··· 105 105 describe('offline', () => { 106 106 beforeAll(() => { 107 107 vi.resetAllMocks(); 108 - globalThis.navigator = { onLine: true } as any; 108 + vi.stubGlobal('navigator', { onLine: true }); 109 + }); 110 + 111 + afterAll(() => { 112 + vi.unstubAllGlobals(); 109 113 }); 110 114 111 115 it('should intercept errored mutations', () => {