mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
test(frontend): replace jest with vitest
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
5241a6e988
commit
49bbd32635
188 changed files with 1364 additions and 1212 deletions
|
@ -7,8 +7,10 @@ import * as UseDarkModeStateModule from './use-dark-mode-state'
|
|||
import { useOutlineButtonVariant } from './use-outline-button-variant'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { describe, it, vitest } from 'vitest'
|
||||
import { vi } from 'vitest'
|
||||
|
||||
jest.mock('./use-dark-mode-state')
|
||||
vi.mock('./use-dark-mode-state')
|
||||
|
||||
describe('useOutlineButtonVariant', () => {
|
||||
const TestComponent: React.FC = () => {
|
||||
|
@ -16,13 +18,13 @@ describe('useOutlineButtonVariant', () => {
|
|||
}
|
||||
|
||||
it('returns the correct variant for dark mode', async () => {
|
||||
jest.spyOn(UseDarkModeStateModule, 'useDarkModeState').mockReturnValue(true)
|
||||
vitest.spyOn(UseDarkModeStateModule, 'useDarkModeState').mockReturnValue(true)
|
||||
render(<TestComponent />)
|
||||
await screen.findByText('outline-light')
|
||||
})
|
||||
|
||||
it('returns the correct variant for light mode', async () => {
|
||||
jest.spyOn(UseDarkModeStateModule, 'useDarkModeState').mockReturnValue(false)
|
||||
vitest.spyOn(UseDarkModeStateModule, 'useDarkModeState').mockReturnValue(false)
|
||||
render(<TestComponent />)
|
||||
await screen.findByText('outline-dark')
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue