/* eslint-disable @typescript-eslint/no-explicit-any */ /** * Global test environment for apps/admin-ui. * * Native / platform modules are redirected to shared shims through * `jest.config.js#moduleNameMapper`; this file only installs process-wide * globals that every suite needs. */ // Presigned uploads (useUploadToObjectStorage) go through the global fetch. if (typeof global.fetch !== 'function') { ;(global as any).fetch = jest.fn(async () => ({ ok: true, status: 200 })) } // Silence noisy console output that the app logs during render. const IGNORED_CONSOLE = [ /\[admin-ui\]/, /Failed to save push token/, /force logout event received/, ] const originalConsoleError = console.error console.error = (...args: any[]) => { const message = String(args[0] ?? '') if (IGNORED_CONSOLE.some((pattern) => pattern.test(message))) return originalConsoleError(...args) } console.log = jest.fn() console.warn = jest.fn() // React 19 + testing-library act() environment. ;(global as any).IS_REACT_ACT_ENVIRONMENT = true afterEach(() => { jest.clearAllTimers() })