Skip to content

Commit a1901ca

Browse files
committed
Change .toHaveBeenCalledTimes(0) to .not.toHaveBeenCalled()
1 parent 88f08e9 commit a1901ca

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/toolkit/src/query/tests/cacheLifecycle.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ test('updateCachedData', async () => {
505505
draft.value = 'TEST'
506506
trackCalls()
507507
})
508-
expect(trackCalls).toHaveBeenCalledTimes(0)
508+
expect(trackCalls).not.toHaveBeenCalled()
509509
expect(getCacheEntry().data).toEqual(undefined)
510510

511511
gotFirstValue(await cacheDataLoaded)
@@ -612,7 +612,7 @@ test('dispatching a mutation initializer with `track: false` does not start a li
612612
await storeRef.store.dispatch(
613613
extended.endpoints.injected.initiate(undefined, { track: false }),
614614
)
615-
expect(onNewCacheEntry).toHaveBeenCalledTimes(0)
615+
expect(onNewCacheEntry).not.toHaveBeenCalled()
616616

617617
await storeRef.store.dispatch(extended.endpoints.injected.initiate(undefined))
618618
expect(onNewCacheEntry).toHaveBeenCalledOnce()

packages/toolkit/src/query/tests/createApi.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ describe('custom serializeQueryArgs per endpoint', () => {
10171017
api.endpoints.queryWithNoSerializer.initiate(99),
10181018
)
10191019

1020-
expect(serializer1).toHaveBeenCalledTimes(0)
1020+
expect(serializer1).not.toHaveBeenCalled()
10211021

10221022
await storeRef.store.dispatch(
10231023
api.endpoints.queryWithCustomSerializer.initiate(42),
@@ -1046,7 +1046,7 @@ describe('custom serializeQueryArgs per endpoint', () => {
10461046
})
10471047

10481048
it('Works via injectEndpoints', async () => {
1049-
expect(serializer2).toHaveBeenCalledTimes(0)
1049+
expect(serializer2).not.toHaveBeenCalled()
10501050

10511051
await storeRef.store.dispatch(
10521052
injectedApi.endpoints.injectedQueryWithCustomSerializer.initiate(5),

packages/toolkit/src/tests/createAsyncThunk.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ describe('conditional skipping of asyncThunks', () => {
606606
const condition = () => Promise.resolve(false)
607607
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition })
608608
await asyncThunk(arg)(dispatch, getState, extra)
609-
expect(dispatch).toHaveBeenCalledTimes(0)
609+
expect(dispatch).not.toHaveBeenCalled()
610610
})
611611

612612
test('async condition with rejected promise', async () => {
@@ -631,14 +631,14 @@ describe('conditional skipping of asyncThunks', () => {
631631
thunkPromise.abort()
632632
await thunkPromise
633633
} catch (err) {}
634-
expect(dispatch).toHaveBeenCalledTimes(0)
634+
expect(dispatch).not.toHaveBeenCalled()
635635
})
636636

637637
test('rejected action is not dispatched by default', async () => {
638638
const asyncThunk = createAsyncThunk('test', payloadCreator, { condition })
639639
await asyncThunk(arg)(dispatch, getState, extra)
640640

641-
expect(dispatch).toHaveBeenCalledTimes(0)
641+
expect(dispatch).not.toHaveBeenCalled()
642642
})
643643

644644
test('does not fail when attempting to abort a canceled promise', async () => {

0 commit comments

Comments
 (0)