test(web): update AlbumCard test for dropped year line
test-web / test (push) Successful in 32s

This commit is contained in:
2026-06-01 19:59:40 -04:00
parent a92f2c0121
commit 5b25f89c01
+7 -3
View File
@@ -53,18 +53,22 @@ const album: AlbumRef = {
afterEach(() => vi.clearAllMocks());
describe('AlbumCard', () => {
test('renders cover, title, year inside a link to /albums/:id', () => {
test('renders cover, title, artist inside a link to /albums/:id', () => {
const { container } = render(AlbumCard, { props: { album } });
const link = screen.getByRole('link');
expect(link).toHaveAttribute('href', '/albums/xyz');
expect(link).toHaveTextContent('Kind of Blue');
expect(link).toHaveTextContent('1959');
expect(link).toHaveTextContent('Miles Davis');
// The year is intentionally omitted from the Home tile —
// dropped in the visual polish pass; the album detail page
// still shows it.
expect(link).not.toHaveTextContent('1959');
const img = container.querySelector('img') as HTMLImageElement;
expect(img.src).toContain('/api/albums/xyz/cover');
});
test('year is omitted when not present', () => {
test('year is not rendered on the tile even when present', () => {
render(AlbumCard, { props: { album: { ...album, year: undefined } } });
expect(screen.queryByText(/1959/)).not.toBeInTheDocument();
});