refactor(web): sweep playlist.test.ts to use emptyQuarantineMock() (#375)

Replaces the hand-rolled { subscribe, data } quarantine stub with the
emptyQuarantineMock() helper. readable() satisfies the same store
contract the page actually uses (subscription via $store), and the
playlist tests don't assert on quarantine state — the mock is purely
a transitive module-load satisfier (PlaylistTrackRow → TrackMenu).

Companion to commit 7e8d196 (likes sweep), which initially skipped
this file because it shared the hand-rolled stub shape with the likes
mock; the quarantine half can safely move to the helper.

Five other files in the original 8-file batch (PlaylistTrackRow,
TrackMenu, TrackRow, PlayerBar, CompactTrackCard) were absorbed into
that likes-sweep commit; search/tracks was absorbed into commit
dd67f28 (pageUrl sweep). hidden.test.ts SKIPPED — it imports
createMyQuarantineQuery as a vi.fn() to mockReturnValue per-test and
asserts on unflagTrack call args; the helper would defeat both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-10 15:42:57 -04:00
parent 7e8d19606a
commit 2ec54bc429
@@ -1,6 +1,7 @@
import { describe, expect, test, vi } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/svelte';
import { mockQuery } from '../../../test-utils/query';
import { emptyQuarantineMock } from '../../../test-utils/mocks/quarantine';
import type { PlaylistDetail } from '$lib/api/types';
// Project canonical: $app/state (rune-state), not $app/stores (legacy
@@ -38,11 +39,7 @@ vi.mock('$lib/api/likes', () => ({
likeEntity: vi.fn(),
unlikeEntity: vi.fn()
}));
vi.mock('$lib/api/quarantine', () => ({
createMyQuarantineQuery: () => ({ subscribe: () => () => {}, data: [] }),
flagTrack: vi.fn(),
unflagTrack: vi.fn()
}));
vi.mock('$lib/api/quarantine', () => emptyQuarantineMock());
vi.mock('$lib/api/admin/tracks', () => ({ removeTrack: vi.fn() }));
import PlaylistDetailPage from './+page.svelte';