import { requestCode, verifyCode } from './zozochat'; it('requestCode calls endpoint', async () => { const spy = vi.spyOn(global, 'fetch' as any).mockResolvedValue({ ok: true, json: async () => ({}), } as Response); await expect(requestCode('user@example.com')).resolves.toBeUndefined(); expect(spy).toHaveBeenCalledWith( '/wp-json/zozo-chat/v1/request_code', expect.objectContaining({ method: 'POST' }) ); spy.mockRestore(); });