soulsync/webui/src/test/shell-bridge.ts
Antti Kettunen d0245e3e16
test(webui): share shell bridge test helper
- add a reusable shell bridge factory for legacy shell-backed tests
- trim route and bridge fixtures down to only the overrides they need
2026-05-23 21:23:33 +03:00

24 lines
850 B
TypeScript

import { vi } from 'vitest';
import type { ShellBridge, ShellPageId } from '@/platform/shell/bridge';
export function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge {
const bridge: ShellBridge = {
getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })),
isPageAllowed: vi.fn(() => true),
getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'),
resolveLegacyPath: vi.fn<(pathname: string) => ShellPageId | null>(() => 'search'),
setActivePageChrome: vi.fn(),
activateLegacyPath: vi.fn(),
cancelSimilarArtistsLoad: vi.fn(),
navigateToArtistDetail: vi.fn(),
playLibraryTrack: vi.fn(),
showReactHost: vi.fn(),
startStream: vi.fn(),
showLoadingOverlay: vi.fn(),
hideLoadingOverlay: vi.fn(),
};
Object.assign(bridge, overrides);
return bridge;
}