Skip to content

Commit 70eb3e0

Browse files
committed
internal: Get rid of a bunch of warnings in sub tests
1 parent 2763e63 commit 70eb3e0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/react/src/__tests__/__snapshots__/subscriptions-endpoint.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`CacheProvider with subscriptions should console.error() with no frequency specified 1`] = `
44
[

packages/react/src/__tests__/subscriptions-endpoint.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ describe.each([
108108

109109
it('useSubscription() + useCache()', async () => {
110110
jest.useFakeTimers({
111+
// nock doesn't like modern timers for some reason
111112
legacyFakeTimers: true,
112113
});
113114
const frequency = PollingArticleResource.get.pollFrequency as number;
@@ -146,6 +147,8 @@ describe.each([
146147
act(() => {
147148
jest.runOnlyPendingTimers();
148149
});
150+
// must be called before real timers or clearInterval won't work properly
151+
renderDataClient.cleanup();
149152
jest.useRealTimers();
150153
await renderDataClient.allSettled();
151154

@@ -168,6 +171,7 @@ describe.each([
168171

169172
it('useSubscription() without active arg', async () => {
170173
jest.useFakeTimers({
174+
// nock doesn't like modern timers for some reason
171175
legacyFakeTimers: true,
172176
});
173177
const frequency = PollingArticleResource.get.pollFrequency as number;
@@ -181,6 +185,9 @@ describe.each([
181185
});
182186

183187
await validateSubscription(result, frequency, articlePayload, waitFor);
188+
// must be called before real timers or clearInterval won't work properly
189+
renderDataClient.cleanup();
190+
jest.useRealTimers();
184191
await renderDataClient.allSettled();
185192
});
186193

0 commit comments

Comments
 (0)