// jest setup: polyfill structuredClone for fake-indexeddb if (typeof globalThis.structuredClone !== 'function') { globalThis.structuredClone = (obj) => JSON.parse(JSON.stringify(obj)); } // polyfill TextEncoder/TextDecoder for jsdom environment if (typeof globalThis.TextEncoder === 'undefined') { const { TextEncoder: TE, TextDecoder: TD } = require('util'); globalThis.TextEncoder = TE; globalThis.TextDecoder = TD; } if (typeof globalThis.TextDecoder === 'undefined') { const { TextDecoder: TD } = require('util'); globalThis.TextDecoder = TD; }