Skip to content

Commit

Permalink
chore: Update layouts/Footer tests to Vitest (#3210)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Sep 19, 2024
1 parent ba1db36 commit 20b2f53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { render, screen } from '@testing-library/react'
import { MemoryRouter, Route } from 'react-router-dom'
import { vi } from 'vitest'

import config from 'config'

import Footer from './Footer'

jest.mock('config')
vi.mock('config')

const wrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (
<MemoryRouter initialEntries={['/bb/critical-role/bells-hells']}>
Expand All @@ -24,14 +25,14 @@ describe('Footer', () => {

describe('renders the current years copyright', () => {
beforeEach(() => {
jest.useFakeTimers().setSystemTime(new Date('3301-01-01'))
vi.useFakeTimers().setSystemTime(new Date('3301-01-01'))
setup()
})

afterEach(() => jest.resetAllMocks())
afterEach(() => vi.resetAllMocks())

afterAll(() => {
jest.useRealTimers()
vi.useRealTimers()
})

it('renders a link', () => {
Expand All @@ -48,7 +49,7 @@ describe('Footer', () => {
setup()
})

afterEach(() => jest.resetAllMocks())
afterEach(() => vi.resetAllMocks())

it('renders the link', () => {
render(<Footer />, { wrapper })
Expand All @@ -63,7 +64,7 @@ describe('Footer', () => {
setup({ selfHosted: true })
})

afterEach(() => jest.resetAllMocks())
afterEach(() => vi.resetAllMocks())

it('does not render pricing link', () => {
render(<Footer />, { wrapper })
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 20b2f53

Please sign in to comment.