The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
import { describe, expect, it, vi } from 'vitest';
import { apiClient } from './client';
import { nativeAuthApi } from './nativeAuth';
vi.mock('./client', () => ({ apiClient: { post: vi.fn() } }));
describe('nativeAuthApi', () => {
it('mints a hand-off code for a challenge', async () => {
vi.mocked(apiClient.post).mockResolvedValue({ data: { code: 'c1' } });
await expect(nativeAuthApi.handoff('ab'.repeat(32))).resolves.toEqual({ code: 'c1' });
expect(apiClient.post).toHaveBeenCalledWith('/auth/native/handoff', { challenge: 'ab'.repeat(32) });
});
it('redeems the code with its verifier', async () => {
vi.mocked(apiClient.post).mockResolvedValue({ data: { ok: true } });
await expect(nativeAuthApi.exchange({ code: 'c1', verifier: 'v'.repeat(64) })).resolves.toBeUndefined();
expect(apiClient.post).toHaveBeenCalledWith('/auth/native/exchange', { code: 'c1', verifier: 'v'.repeat(64) });
});
});