Skip to content

Commit 0536468

Browse files
committed
Silence "unhandled error" in ApiProvider error test
1 parent f861244 commit 0536468

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ const api = createApi({
3232
}),
3333
})
3434

35+
afterEach(() => {
36+
vi.resetAllMocks()
37+
})
38+
3539
describe('ApiProvider', () => {
3640
test('ApiProvider allows a user to make queries without a traditional Redux setup', async () => {
3741
function User() {
@@ -72,6 +76,8 @@ describe('ApiProvider', () => {
7276
expect(getByTestId('isFetching').textContent).toBe('false')
7377
})
7478
test('ApiProvider throws if nested inside a Redux context', () => {
79+
// Intentionally swallow the "unhandled error" message
80+
vi.spyOn(console, 'error').mockImplementation(() => {})
7581
expect(() =>
7682
render(
7783
<Provider store={configureStore({ reducer: () => null })}>

0 commit comments

Comments
 (0)