Skip to content

Commit

Permalink
test: simplify console mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
gwansikk committed Dec 3, 2024
1 parent 3a46e54 commit e86ce47
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/react-query/src/bin/utils/switchVersion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { MockInstance } from 'vitest'
import { copy } from './copy'
import { switchVersion } from './switchVersion'

Expand All @@ -7,16 +6,12 @@ vi.mock('./copy', () => ({
}))

describe('switchVersion', () => {
let consoleLogSpy: MockInstance
let consoleWarnSpy: MockInstance
const consoleLogSpy = vi.spyOn(console, 'log').mockClear()
const consoleWarnSpy = vi.spyOn(console, 'warn').mockClear()

beforeEach(() => {
consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
})

afterEach(() => {
vi.restoreAllMocks()
vi.resetModules()
vi.clearAllMocks()
})

it('should log success message when copy function returns true', () => {
Expand Down

0 comments on commit e86ce47

Please sign in to comment.