- Add ciphera.net and *.gstatic.com to CSP img-src (fixes app switcher icons and site favicons blocked by Content Security Policy) - Delete 6 unused component/utility files and orphaned test - Upgrade @types/react and @types/react-dom to v19 (matches React 19 runtime) - Fix logger test to use vi.stubEnv for React 19 type compatibility
32 lines
852 B
TypeScript
32 lines
852 B
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
|
|
describe('logger', () => {
|
|
beforeEach(() => {
|
|
vi.resetModules()
|
|
})
|
|
|
|
it('calls console.error in development', async () => {
|
|
const spy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
vi.stubEnv('NODE_ENV', 'development')
|
|
|
|
const { logger } = await import('../logger')
|
|
logger.error('test error')
|
|
|
|
expect(spy).toHaveBeenCalledWith('test error')
|
|
spy.mockRestore()
|
|
vi.unstubAllEnvs()
|
|
})
|
|
|
|
it('calls console.warn in development', async () => {
|
|
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
vi.stubEnv('NODE_ENV', 'development')
|
|
|
|
const { logger } = await import('../logger')
|
|
logger.warn('test warning')
|
|
|
|
expect(spy).toHaveBeenCalledWith('test warning')
|
|
spy.mockRestore()
|
|
vi.unstubAllEnvs()
|
|
})
|
|
})
|