diff --git a/web/src/routes/albums/[id]/+page.svelte b/web/src/routes/albums/[id]/+page.svelte index 0f03714a..d438c7cb 100644 --- a/web/src/routes/albums/[id]/+page.svelte +++ b/web/src/routes/albums/[id]/+page.svelte @@ -35,6 +35,13 @@ {:else if query.data} {@const album = query.data} + + ← {album.artist_name} + +
{ render(AlbumPage); expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Kind of Blue'); - expect(screen.getByRole('link', { name: /Miles Davis/ })).toHaveAttribute('href', '/artists/md'); + // Two links point at /artists/md: the back chevron and the inline hero link. + // getAllByRole returns both; both should target the artist page. + const artistLinks = screen.getAllByRole('link', { name: /Miles Davis/ }); + expect(artistLinks.length).toBeGreaterThanOrEqual(1); + artistLinks.forEach((l) => expect(l).toHaveAttribute('href', '/artists/md')); expect(screen.getByText(/1959/)).toBeInTheDocument(); expect(screen.getByText(/2 tracks/i)).toBeInTheDocument(); @@ -71,7 +75,9 @@ describe('album detail page', () => { }; (createAlbumQuery as ReturnType).mockReturnValue(mockQuery({ data: detail })); render(AlbumPage); - const back = screen.getByRole('link', { name: /Miles Davis/ }); + // Back chevron specifically (disambiguated from the inline artist link by + // the leading arrow character). + const back = screen.getByRole('link', { name: /^← Miles Davis/ }); expect(back).toHaveAttribute('href', '/artists/md'); });