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:
2026-05-10 15:58:14 -04:00
parent 993bcc6a14
commit 9b4f907db6
24 changed files with 95 additions and 202 deletions
+4 -4
View File
@@ -3,6 +3,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/svelte';
import { readable } from 'svelte/store';
import { emptyLikesMock } from '../../test-utils/mocks/likes';
import type { TrackRef } from '$lib/api/types';
import { makeTracks } from '$test-utils/fixtures/track';
vi.mock('$app/navigation', () => ({ goto: vi.fn() }));
@@ -30,10 +31,9 @@ import { listAlbumTracks } from '$lib/api/albums';
import { likeEntity } from '$lib/api/likes';
import { goto } from '$app/navigation';
const TRACKS: TrackRef[] = [
{ id: 't1', title: 'A', album_id: 'al1', album_title: 'Disc', artist_id: 'a1', artist_name: 'Test', duration_sec: 100, stream_url: '/s/t1' },
{ id: 't2', title: 'B', album_id: 'al1', album_title: 'Disc', artist_id: 'a1', artist_name: 'Test', duration_sec: 100, stream_url: '/s/t2' }
];
const TRACKS: TrackRef[] = makeTracks(2, {
album_id: 'al1', album_title: 'Disc', artist_id: 'a1', artist_name: 'Test'
});
const PROPS = { albumId: 'al1', albumTitle: 'Disc', artistId: 'a1', artistName: 'Test' };