platform-codebase/features/status-dashboard/frontend/test/setup.ts
Quinn Ftw 02ab9cc22b feat(status-dashboard): push-based host monitoring and testing infra
- Add host-status-monitor with macOS/Linux support
- Add vitest + playwright testing setup
- Add docker-compose for local development
- Add metrics persistence service
- Improve deploy scripts and env configs
- Update frontend components and auth

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:37:26 -08:00

31 lines
828 B
TypeScript

import { afterEach, vi } from 'vitest';
import { cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';
// Cleanup after each test
afterEach(() => {
cleanup();
});
// Mock WebSocket globally (used by socket.io-client)
global.WebSocket = vi.fn(() => ({
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
send: vi.fn(),
close: vi.fn(),
})) as unknown as typeof WebSocket;
// Mock matchMedia (used by theme-provider for system theme detection)
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});