mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[UnitTests] Add a mock to window.localStorage so that filter tests don't fail if using useLanguage
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { vi } from 'vitest'
|
||||
|
||||
// Some FilterView filter modules pull in useLanguage -> redux/auth -> apiConnection, which
|
||||
// reads window.localStorage at module load time. Stub it so those modules can be imported
|
||||
// under Vitest's Node test environment.
|
||||
vi.stubGlobal('window', { localStorage: { getItem: () => null } })
|
||||
@@ -11,6 +11,7 @@ export default defineConfig({
|
||||
test: {
|
||||
reporters: ['tree'],
|
||||
exclude: ['./dist', 'node_modules'],
|
||||
setupFiles: ['./tests/unit/setup.ts'],
|
||||
pool: 'threads',
|
||||
testTimeout: 10_000, // 10s timeout
|
||||
sequence: {
|
||||
|
||||
Reference in New Issue
Block a user