Files
headroom/frontend/tests/setup.ts
Santhosh Janardhanan 493cb78173 feat(layout): finalize p01 and p02 changes
Complete UI foundation and app layout implementation, stabilize container health checks, and archive both OpenSpec changes after verification.
2026-02-18 16:12:11 -05:00

51 lines
957 B
TypeScript

import { vi } from 'vitest';
// Mock localStorage
const localStorageMock: Storage = {
get length() {
return 0;
},
key: vi.fn(() => null),
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn(),
clear: vi.fn(),
};
global.localStorage = localStorageMock;
// Mock fetch
global.fetch = vi.fn();
// Mock window
global.window = {
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
CustomEvent: class CustomEvent {
type: string;
detail: unknown;
constructor(type: string, options?: { detail?: unknown }) {
this.type = type;
this.detail = options?.detail;
}
},
} as unknown as Window & typeof globalThis;
// Mock import.meta.env
Object.defineProperty(global, 'import', {
value: {
meta: {
env: {
VITE_API_URL: 'http://localhost:3000/api',
},
},
},
writable: true,
});
// Cleanup after each test
afterEach(() => {
vi.clearAllMocks();
});