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:
@@ -44,7 +44,7 @@ function page<T>(items: T[], total: number, offset = 0, limit = 50): Page<T> {
|
||||
}
|
||||
|
||||
const album: AlbumRef = {
|
||||
id: 'al1', title: 'Kind of Blue', artist_id: 'a1', artist_name: 'Miles Davis',
|
||||
id: 'al1', title: 'Kind of Blue', sort_title: 'Kind of Blue', artist_id: 'a1', artist_name: 'Miles Davis',
|
||||
year: 1959, track_count: 5, duration_sec: 2630, cover_url: '/api/albums/al1/cover'
|
||||
};
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ afterEach(() => {
|
||||
|
||||
describe('search artists overflow', () => {
|
||||
test('renders a row per artist', () => {
|
||||
const a1: ArtistRef = { id: 'a1', name: 'Miles Davis', album_count: 12 };
|
||||
const a2: ArtistRef = { id: 'a2', name: 'Miles Mosley', album_count: 1 };
|
||||
const a1: ArtistRef = { id: 'a1', name: 'Miles Davis', sort_name: 'Miles Davis', album_count: 12, cover_url: '' };
|
||||
const a2: ArtistRef = { id: 'a2', name: 'Miles Mosley', sort_name: 'Miles Mosley', album_count: 1, cover_url: '' };
|
||||
(createSearchArtistsInfiniteQuery as ReturnType<typeof vi.fn>).mockReturnValue(
|
||||
mockInfiniteQuery({ pages: [page([a1, a2], 2)] })
|
||||
);
|
||||
@@ -69,7 +69,7 @@ describe('search artists overflow', () => {
|
||||
|
||||
test('Load more is hidden when hasNextPage is false', () => {
|
||||
(createSearchArtistsInfiniteQuery as ReturnType<typeof vi.fn>).mockReturnValue(
|
||||
mockInfiniteQuery({ pages: [page<ArtistRef>([{ id: 'a', name: 'A', album_count: 1 }], 1)] })
|
||||
mockInfiniteQuery({ pages: [page<ArtistRef>([{ id: 'a', name: 'A', sort_name: 'A', album_count: 1, cover_url: '' }], 1)] })
|
||||
);
|
||||
render(ArtistsOverflow);
|
||||
expect(screen.queryByRole('button', { name: /load more/i })).not.toBeInTheDocument();
|
||||
|
||||
@@ -53,9 +53,9 @@ function emptyResp(): SearchResponse {
|
||||
};
|
||||
}
|
||||
|
||||
const artist: ArtistRef = { id: 'a1', name: 'Miles Davis', album_count: 12 };
|
||||
const artist: ArtistRef = { id: 'a1', name: 'Miles Davis', sort_name: 'Miles Davis', album_count: 12, cover_url: '' };
|
||||
const album: AlbumRef = {
|
||||
id: 'al1', title: 'Kind of Blue', artist_id: 'a1', artist_name: 'Miles Davis',
|
||||
id: 'al1', title: 'Kind of Blue', sort_title: 'Kind of Blue', artist_id: 'a1', artist_name: 'Miles Davis',
|
||||
year: 1959, track_count: 5, duration_sec: 2630, cover_url: '/api/albums/al1/cover'
|
||||
};
|
||||
const track: TrackRef = {
|
||||
|
||||
Reference in New Issue
Block a user