Skip to content

Commit

Permalink
remove no longer needed double mock def
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM committed May 22, 2024
1 parent 0e5ea27 commit 4b42b86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions packages/router/src/__tests__/routeScrollReset.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

import { act, cleanup, render, screen } from '@testing-library/react'
import { describe, beforeEach, afterEach, it, vi, expect } from 'vitest'
import { describe, beforeEach, afterEach, it, expect } from 'vitest'
import type { Mock } from 'vitest'

import { navigate } from '../history'
Expand All @@ -19,11 +19,6 @@ describe('Router scroll reset', () => {
</Router>
)

// Redfine the mocks here again (already done in jest.setup)
// Otherwise the mock doesn't clear for some reason
// @ts-expect-error TODO(jgmw): Fix this typing
globalThis.scrollTo = vi.fn()

beforeEach(async () => {
;(globalThis.scrollTo as Mock).mockClear()
render(<TestRouter />)
Expand Down
2 changes: 1 addition & 1 deletion packages/router/vitest.setup.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@testing-library/jest-dom/vitest'
import { afterEach, vi } from 'vitest'
import { cleanup } from '@testing-library/react'

// @ts-expect-error TODO(jgmw): Fix this typing
// @ts-expect-error
globalThis.scrollTo = vi.fn()

afterEach(() => {
Expand Down

0 comments on commit 4b42b86

Please sign in to comment.