feat(web): extend ArtistRef/AlbumRef + add HomePayload + new query keys
Adds sort_name/cover_url to ArtistRef, sort_title to AlbumRef (matching backend Task 5 wire shape), HomePayload type, and qk.home/albumsAlpha/ artistTracks query keys. Updates existing test fixtures to satisfy the new required fields. Verified clean via 'npm run check' (0 errors, only pre-existing warnings). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ import { createArtistQuery } from '$lib/api/queries';
|
||||
function album(id: string, title: string, year?: number): AlbumRef {
|
||||
return {
|
||||
id, title,
|
||||
sort_title: title,
|
||||
artist_id: 'abc', artist_name: 'Alice',
|
||||
year, track_count: 10, duration_sec: 2400,
|
||||
cover_url: `/api/albums/${id}/cover`
|
||||
@@ -54,7 +55,7 @@ afterEach(() => {
|
||||
describe('artist detail page', () => {
|
||||
test('renders artist name, subtitle, and one AlbumCard per album', () => {
|
||||
const detail: ArtistDetail = {
|
||||
id: 'abc', name: 'Alice', album_count: 2,
|
||||
id: 'abc', name: 'Alice', sort_name: 'Alice', album_count: 2, cover_url: '',
|
||||
albums: [album('a1', 'First', 2020), album('a2', 'Second')]
|
||||
};
|
||||
(createArtistQuery as ReturnType<typeof vi.fn>).mockReturnValue(mockQuery({ data: detail }));
|
||||
@@ -67,7 +68,7 @@ describe('artist detail page', () => {
|
||||
|
||||
test('back link points to Library', () => {
|
||||
(createArtistQuery as ReturnType<typeof vi.fn>).mockReturnValue(mockQuery({
|
||||
data: { id: 'abc', name: 'Alice', album_count: 0, albums: [] }
|
||||
data: { id: 'abc', name: 'Alice', sort_name: 'Alice', album_count: 0, cover_url: '', albums: [] }
|
||||
}));
|
||||
render(ArtistPage);
|
||||
const back = screen.getByRole('link', { name: /library/i });
|
||||
|
||||
Reference in New Issue
Block a user