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

OAuthAuthorizePage reloads the user on mount and useDashboard's retry
reloads it too. The real loadUser then registers the background sync
triggers, a 30 s heartbeat and window listeners that nothing in either
spec unregisters, so they outlive the tests the same way they did in the
account specs before 27db5dd5e. Both specs now stub the triggers, which
neither is about.
This commit is contained in:
Maurice
2026-10-08 12:49:02 +02:00
parent ead327be73
commit 6a6f3f6cf6
2 changed files with 12 additions and 0 deletions
@@ -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';
@@ -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' });