Skip to content

Commit 65a6ae3

Browse files
committed
Added mockClear() to mockBaseQuery in failing test
1 parent e7fce61 commit 65a6ae3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/toolkit/src/query/tests/polling.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ describe('polling tests', () => {
124124
})
125125

126126
it('respects skipPollOnFocusLost', async () => {
127+
mockBaseQuery.mockClear()
127128
storeRef.store.dispatch(
128129
getPosts.initiate(1, {
129130
subscriptionOptions: { pollingInterval: 10, skipPollOnFocusLost: true },
@@ -146,6 +147,7 @@ describe('polling tests', () => {
146147

147148
await delay(30)
148149
const callsWithoutSkip = mockBaseQuery.mock.calls.length
150+
console.log(callsWithSkip, callsWithoutSkip)
149151

150152
expect(callsWithSkip).toBe(1)
151153
expect(callsWithoutSkip).toBeGreaterThan(2)
@@ -183,7 +185,7 @@ describe('polling tests', () => {
183185
const { requestId, queryCacheKey, ...subscription } =
184186
storeRef.store.dispatch(
185187
getPosts.initiate(1, {
186-
subscriptionOptions: { pollingInterval: 10 },
188+
subscriptionOptions: { pollingInterval: 10, skipPollOnFocusLost: false },
187189
subscribe: true,
188190
})
189191
)

0 commit comments

Comments
 (0)