Set up the complete project foundation for ClawX, a graphical AI assistant: - Electron main process with IPC handlers, menu, tray, and gateway management - React renderer with routing, layout components, and page scaffolding - Zustand state management for gateway, settings, channels, skills, chat, and cron - shadcn/ui components with Tailwind CSS and CSS variable theming - Build tooling with Vite, electron-builder, and TypeScript configuration - Testing setup with Vitest and Playwright - Development configurations (ESLint, Prettier, gitignore, env example)
45 lines
864 B
TypeScript
45 lines
864 B
TypeScript
/**
|
|
* Vitest Test Setup
|
|
* Global test configuration and mocks
|
|
*/
|
|
import { vi } from 'vitest';
|
|
import '@testing-library/jest-dom';
|
|
|
|
// Mock window.electron API
|
|
const mockElectron = {
|
|
ipcRenderer: {
|
|
invoke: vi.fn(),
|
|
on: vi.fn(),
|
|
once: vi.fn(),
|
|
off: vi.fn(),
|
|
},
|
|
openExternal: vi.fn(),
|
|
platform: 'darwin',
|
|
isDev: true,
|
|
};
|
|
|
|
Object.defineProperty(window, 'electron', {
|
|
value: mockElectron,
|
|
writable: true,
|
|
});
|
|
|
|
// Mock matchMedia
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(),
|
|
removeListener: vi.fn(),
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
});
|
|
|
|
// Reset mocks after each test
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|