test: improve frontend coverage and exclude backend docker services
This commit is contained in:
17
frontend/src/hooks/__tests__/useTheme.test.tsx
Normal file
17
frontend/src/hooks/__tests__/useTheme.test.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import { useTheme } from '../useTheme'
|
||||
|
||||
describe('useTheme', () => {
|
||||
it('throws error when used outside ThemeProvider', () => {
|
||||
// Suppress console.error for this test as React logs the error
|
||||
const consoleSpy = vi.spyOn(console, 'error')
|
||||
consoleSpy.mockImplementation(() => {})
|
||||
|
||||
expect(() => {
|
||||
renderHook(() => useTheme())
|
||||
}).toThrow('useTheme must be used within a ThemeProvider')
|
||||
|
||||
consoleSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user