Skip to content

Commit

Permalink
test: prevent state modifications in afterEach
Browse files Browse the repository at this point in the history
  • Loading branch information
lislon committed Nov 17, 2024
1 parent 88fa2eb commit 17c459c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-router/tests/router.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
import type { AnyRoute, AnyRouter, RouterOptions } from '../src'

afterEach(() => {
// @ts-ignore
window.__TSR__ROUTER__.history.destroy()
vi.resetAllMocks()
window.history.replaceState(null, 'root', '/')
cleanup()
Expand Down Expand Up @@ -1125,7 +1127,7 @@ describe('router state', () => {
expect(router.state.status).toBe('idle')
})

// ensure the router is stable once idle and do not update its state
// ensure the router is stable once idle and do not update its state since then
expect(stateHistory.slice(-2).map((s) => s.status)).toStrictEqual([
'pending',
'idle',
Expand Down

0 comments on commit 17c459c

Please sign in to comment.