import { http, HttpResponse } from 'msw'; /** * Default MSW handlers for SmartStack API endpoints. * These handlers mock common API calls used across the application. * * Override these in individual tests using server.use(). * * @example * // In a test file: * server.use( * http.get('/api/products', () => * HttpResponse.json({ * items: [{ id: '1', code: 'P-01', name: 'Test Product' }], * totalCount: 1, * pageNumber: 1, * pageSize: 10, * }) * ) * ); */ export const handlers = [ // Auth endpoints http.get('/api/auth/me', () => HttpResponse.json({ id: 'test-user-id', email: 'test-admin@smartstack.io', name: 'Test Admin', role: 'Administrator', permissions: ['*'], }) ), http.post('/api/auth/login', () => HttpResponse.json({ token: 'test-jwt-token', user: { id: 'test-user-id', email: 'test-admin@smartstack.io', name: 'Test Admin', }, }) ), // Navigation endpoints http.get('/api/navigation', () => HttpResponse.json([]) ), // User preferences http.get('/api/users/preferences', () => HttpResponse.json({}) ), http.put('/api/users/preferences', () => HttpResponse.json({ success: true }) ), ];