Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

test(client): stub the sync triggers in the consent and dashboard specs

Maurice6a6f3f6cf6e6
diff --git a/client/src/pages/OAuthAuthorizePage.test.tsx b/client/src/pages/OAuthAuthorizePage.test.tsx
index fa84f016d..69a22f629 100644
--- a/client/src/pages/OAuthAuthorizePage.test.tsx
+++ b/client/src/pages/OAuthAuthorizePage.test.tsx
@@ -8,6 +8,12 @@ import { resetAllStores, seedStore } from '../../tests/helpers/store';
import { buildUser } from '../../tests/helpers/factories';
import OAuthAuthorizePage from './OAuthAuthorizePage';
+// The consent page reloads the user on mount, and loadUser registers the
+// background sync triggers: a 30 s heartbeat and window listeners that nothing
+// here unregisters, so they outlive the test and can fire, and log, while the
+// file's worker shuts down. Nothing here is about sync.
+vi.mock('../sync/syncTriggers', () => ({ registerSyncTriggers: vi.fn(), unregisterSyncTriggers: vi.fn() }));
+
// Default OAuth query params
const DEFAULT_SEARCH = '?client_id=test-client&redirect_uri=http%3A%2F%2Flocalhost%3A4000%2Fcallback&scope=trips%3Aread&state=abc&code_challenge=challenge&code_challenge_method=S256';
diff --git a/client/src/pages/dashboard/useDashboard.test.tsx b/client/src/pages/dashboard/useDashboard.test.tsx
index 6031b7d35..f3e2d44c8 100644
--- a/client/src/pages/dashboard/useDashboard.test.tsx
+++ b/client/src/pages/dashboard/useDashboard.test.tsx
@@ -11,6 +11,12 @@ import { useAuthStore } from '../../store/authStore';
import { useDashboard } from './useDashboard';
import type { DashboardTrip } from './dashboardModel';
+// Retrying reloads the user, and loadUser registers the background sync
+// triggers: a 30 s heartbeat and window listeners that nothing here
+// unregisters, so they outlive the test and can fire, and log, while the
+// file's worker shuts down. Nothing here is about sync.
+vi.mock('../../sync/syncTriggers', () => ({ registerSyncTriggers: vi.fn(), unregisterSyncTriggers: vi.fn() }));
+
// FE-HOOK-DASH-001 onwards
const PARIS = buildTrip({ id: 101, title: 'Paris Adventure', start_date: '2026-07-01', end_date: '2026-07-10' });