diff --git a/apps/fxblox-web/src/app/__tests__/guards.test.tsx b/apps/fxblox-web/src/app/__tests__/guards.test.tsx index d3f5c78..36d2c8a 100644 --- a/apps/fxblox-web/src/app/__tests__/guards.test.tsx +++ b/apps/fxblox-web/src/app/__tests__/guards.test.tsx @@ -20,6 +20,15 @@ vi.mock('@/app/bootstrap', () => ({ return boot.current!.promise; }, })); +// Landing on /blox mounts the main shell, whose `useEnsureFulaClient` calls `initFula` for the current Blox. +// Left real, that boots an actual libp2p node inside jsdom — seconds of work that these routing tests never +// look at, and whose timers outlive the test (see ConnectToBlox.test.tsx for the unhandled-error shape). It +// is also why "set up → / lands on /blox" was the one test in the suite that failed under full-suite load +// while passing alone: the route waited on a libp2p boot that nothing here needed. +vi.mock('@/utils/helper', async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, initFula: vi.fn(async () => '12D3KooWAppPeer'.padEnd(52, 'A')) }; +}); import { TestProviders } from '@/test/helpers/renderWithProviders'; import { buildAppRoutes } from '@/app/routes/appRoutes'; diff --git a/apps/fxblox-web/src/screens/InitialSetup/__tests__/ConnectToBlox.test.tsx b/apps/fxblox-web/src/screens/InitialSetup/__tests__/ConnectToBlox.test.tsx index 72d9347..3e02df7 100644 --- a/apps/fxblox-web/src/screens/InitialSetup/__tests__/ConnectToBlox.test.tsx +++ b/apps/fxblox-web/src/screens/InitialSetup/__tests__/ConnectToBlox.test.tsx @@ -22,6 +22,15 @@ vi.mock('@/platform/bluetooth', async (importOriginal) => { vi.mock('@/services/setupDiscovery', () => ({ discoverUnownedBloxes: vi.fn(), })); +// The last test here navigates on to Set authorizer, which calls `initFula` on mount to mint the app peer id. +// Left real, that boots an actual libp2p node inside jsdom, and its `it-queue` timers outlive the test: one of +// them then dispatches an Event from Node's realm into a torn-down jsdom EventTarget, which Vitest reports as +// an unhandled error and fails the run — roughly one full-suite run in three, on CI and on `main`. Every +// sibling setup test already stubs this; this file was the one that did not. +vi.mock('@/utils/helper', async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, initFula: vi.fn(async () => '12D3KooWAppPeer'.padEnd(52, 'A')) }; +}); import { API_URL } from '@/api'; import { BleRegistry } from '@/platform/bluetooth';