/** * Test setup file for the Daily Notification plugin */ import { jest, afterEach } from '@jest/globals'; // Mock Capacitor plugin jest.mock('@capacitor/core', () => ({ Capacitor: { isNativePlatform: () => false, getPlatform: () => 'web', }, WebPlugin: class { constructor() { return { addListener: jest.fn(), removeAllListeners: jest.fn(), }; } }, })); // Mock Response const mockResponse = { ok: true, status: 200, json: jest.fn(), text: jest.fn(), blob: jest.fn(), arrayBuffer: jest.fn(), clone: jest.fn(), headers: new Headers(), redirected: false, statusText: 'OK', type: 'default', url: '', }; global.Response = jest.fn().mockImplementation(() => mockResponse) as unknown as typeof Response; // Mock Date global.Date = jest.fn().mockImplementation(() => ({ getTime: () => 0, toISOString: () => '2024-01-01T00:00:00.000Z', })) as unknown as typeof Date; // Clean up mocks after each test afterEach(() => { jest.clearAllMocks(); });