Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/fxblox-web/src/app/__tests__/guards.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof import('@/utils/helper')>();
return { ...actual, initFula: vi.fn(async () => '12D3KooWAppPeer'.padEnd(52, 'A')) };
});

import { TestProviders } from '@/test/helpers/renderWithProviders';
import { buildAppRoutes } from '@/app/routes/appRoutes';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof import('@/utils/helper')>();
return { ...actual, initFula: vi.fn(async () => '12D3KooWAppPeer'.padEnd(52, 'A')) };
});

import { API_URL } from '@/api';
import { BleRegistry } from '@/platform/bluetooth';
Expand Down
Loading