15 lines
468 B
JavaScript
15 lines
468 B
JavaScript
import 'fake-indexeddb/auto'
|
|
|
|
// jsdom does not provide crypto.subtle — polyfill it with the real Web Crypto API
|
|
// (available in Node 19+ as `node:crypto.webcrypto`)
|
|
if (typeof globalThis.crypto === 'undefined' || !globalThis.crypto.subtle) {
|
|
const { webcrypto } = await import('node:crypto')
|
|
globalThis.crypto = webcrypto
|
|
}
|
|
|
|
// Mock window/document APIs used by security store
|
|
Object.defineProperty(globalThis, 'navigator', {
|
|
value: {},
|
|
writable: true,
|
|
})
|