refactor(web): sweep 24 test files to use makeTrack/makeTracks fixtures (#375)
Replaces inline TrackRef literal redefinitions with calls to the test-utils helper. Tests that asserted on default field values (e.g. track titles, artist names rendered in the DOM) keep explicit overrides; tests that only need a stub for shape now use makeTrack() with no overrides. PlaylistCard.test.ts, PlaylistTrackRow.test.ts, and playlist.test.ts SKIPPED — they use PlaylistTrack (with track_id/added_at), not TrackRef. ArtistCard.svelte and +page.svelte route files (matched by initial grep) SKIPPED — live code, not test files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/svelte';
|
||||
import { readable } from 'svelte/store';
|
||||
import { emptyLikesMock } from '../../test-utils/mocks/likes';
|
||||
import { emptyQuarantineMock } from '../../test-utils/mocks/quarantine';
|
||||
import type { TrackRef } from '$lib/api/types';
|
||||
import { makeTrack } from '$test-utils/fixtures/track';
|
||||
|
||||
// Mutable mock-user handle so individual tests can flip is_admin / null
|
||||
// without re-importing the module under test.
|
||||
@@ -44,16 +44,7 @@ vi.mock('$lib/player/store.svelte', () => ({
|
||||
import TrackMenu from './TrackMenu.svelte';
|
||||
import { playNext, enqueueTrack } from '$lib/player/store.svelte';
|
||||
|
||||
const track: TrackRef = {
|
||||
id: 't1',
|
||||
title: 'Roygbiv',
|
||||
album_id: 'a1',
|
||||
album_title: 'Geogaddi',
|
||||
artist_id: 'ar1',
|
||||
artist_name: 'Boards of Canada',
|
||||
duration_sec: 240,
|
||||
stream_url: '/api/tracks/t1/stream'
|
||||
};
|
||||
const track = makeTrack({ title: 'Roygbiv' });
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user