/** * Jest test setup file * Configures global test environment */ // Mock localStorage if not available if (typeof localStorage === 'undefined') { global.localStorage = { store: {}, getItem(key) { return this.store[key] || null; }, setItem(key, value) { this.store[key] = String(value); }, removeItem(key) { delete this.store[key]; }, clear() { this.store = {}; }, get length() { return Object.keys(this.store).length; }, key(index) { const keys = Object.keys(this.store); return keys[index] || null; } }; } // Mock TextEncoder and TextDecoder if not available if (typeof TextEncoder === 'undefined') { const { TextEncoder, TextDecoder } = require('util'); global.TextEncoder = TextEncoder; global.TextDecoder = TextDecoder; }