From fecda65f11627f20b5fe2a0280833922547944c8 Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Tue, 30 Jun 2026 01:50:37 +0200 Subject: [PATCH] test(m3): retarget collapsed barrel mocks to deep submodules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The move tool rewrote single-module mocks (e.g. vi.mock('@/utils/orbitBulkGuard')) into feature-BARREL mocks (vi.mock('@/features/orbit', ...)). A partial barrel factory shadows every other barrel export to undefined — and src/test/helpers/ storeReset.ts reads useOrbitStore.getState() at module load, so 6 test files (playerStore.misc/events/queue/playbackActions, ContextMenu, QueuePanel) crashed at collection (0 tests run, mis-read as flaky teardown). Retarget each collapsed mock to its deep submodule so the barrel re-exports the stub while siblings (useOrbitStore, offlineActionPolicy, usePlaylistStore) stay real. --- src/components/ContextMenu.test.tsx | 4 ++-- src/components/QueuePanel.test.tsx | 2 +- src/features/offline/utils/pinnedOfflineSync.test.ts | 2 +- src/store/playerStore.events.test.ts | 2 +- src/store/playerStore.misc.test.ts | 2 +- src/store/playerStore.playbackActions.test.ts | 2 +- src/store/playerStore.queue.test.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/ContextMenu.test.tsx b/src/components/ContextMenu.test.tsx index 40d0b6d6..524d0680 100644 --- a/src/components/ContextMenu.test.tsx +++ b/src/components/ContextMenu.test.tsx @@ -30,11 +30,11 @@ vi.mock('@/api/subsonic', () => ({ })); -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), })); -vi.mock('@/features/offline', () => ({ +vi.mock('@/features/offline/hooks/useOfflineBrowseContext', () => ({ useOfflineBrowseContext: () => ({ active: false, serverId: 'srv-1', diff --git a/src/components/QueuePanel.test.tsx b/src/components/QueuePanel.test.tsx index 5e1e3ce3..45e88ec3 100644 --- a/src/components/QueuePanel.test.tsx +++ b/src/components/QueuePanel.test.tsx @@ -26,7 +26,7 @@ vi.mock('@/api/subsonic', () => ({ })); -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), })); diff --git a/src/features/offline/utils/pinnedOfflineSync.test.ts b/src/features/offline/utils/pinnedOfflineSync.test.ts index e09bf89b..426d6f0c 100644 --- a/src/features/offline/utils/pinnedOfflineSync.test.ts +++ b/src/features/offline/utils/pinnedOfflineSync.test.ts @@ -29,7 +29,7 @@ vi.mock('@/utils/network/activeServerReachability', () => ({ onActiveServerBecameReachable: () => () => {}, })); -vi.mock('@/features/playlist', () => ({ +vi.mock('@/features/playlist/api/subsonicPlaylists', () => ({ getPlaylistForServer: (serverId: string, id: string) => getPlaylistMock(serverId, id), })); diff --git a/src/store/playerStore.events.test.ts b/src/store/playerStore.events.test.ts index c0250762..4fe0be5c 100644 --- a/src/store/playerStore.events.test.ts +++ b/src/store/playerStore.events.test.ts @@ -44,7 +44,7 @@ vi.mock('@/music-network', () => { }; }); -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), })); diff --git a/src/store/playerStore.misc.test.ts b/src/store/playerStore.misc.test.ts index 6ada644c..2bce5a96 100644 --- a/src/store/playerStore.misc.test.ts +++ b/src/store/playerStore.misc.test.ts @@ -42,7 +42,7 @@ vi.mock('@/music-network', () => ({ getMusicNetworkRuntimeOrNull: () => runtimeMock, })); -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), })); diff --git a/src/store/playerStore.playbackActions.test.ts b/src/store/playerStore.playbackActions.test.ts index 315be45a..3a64bccd 100644 --- a/src/store/playerStore.playbackActions.test.ts +++ b/src/store/playerStore.playbackActions.test.ts @@ -47,7 +47,7 @@ vi.mock('@/music-network', () => { }; }); -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), })); diff --git a/src/store/playerStore.queue.test.ts b/src/store/playerStore.queue.test.ts index 7c12c579..0f91e910 100644 --- a/src/store/playerStore.queue.test.ts +++ b/src/store/playerStore.queue.test.ts @@ -26,7 +26,7 @@ vi.mock('@/api/subsonic', async () => { // `enqueue` / `enqueueAt` call `orbitBulkGuard` for multi-track inserts when // the caller hasn't pre-confirmed. Force the guard to short-circuit through. -vi.mock('@/features/orbit', () => ({ +vi.mock('@/features/orbit/utils/orbitBulkGuard', () => ({ orbitBulkGuard: vi.fn(async () => true), }));