Replace the Artists route fallback content with a searchable artist list, counts, artwork, and artist-specific playback.
Hop-State: A_06FNPER3B0F42JETD868VDG Hop-Proposal: R_06FNPEQ1X5JW4SKNSA3856G Hop-Task: T_06FNPDXDVREH0RSVM1731Q0 Hop-Attempt: AT_06FNPDXDVS3KPW8HKJPGAA8
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { Track } from "../types";
|
||||
import { buildArtistSummaries } from "./artists";
|
||||
|
||||
const track = (id: string, artist: string, albumId: string): Track => ({
|
||||
id,
|
||||
title: id,
|
||||
artist,
|
||||
album: albumId,
|
||||
albumId,
|
||||
duration: 180,
|
||||
coverTone: "dusk",
|
||||
});
|
||||
|
||||
describe("buildArtistSummaries", () => {
|
||||
it("groups artists case-insensitively and counts their albums and tracks", () => {
|
||||
const artists = buildArtistSummaries([
|
||||
track("song-1", "North Window", "album-1"),
|
||||
track("song-2", "north window", "album-1"),
|
||||
track("song-3", "North Window", "album-2"),
|
||||
track("song-4", "Mara Venn", "album-3"),
|
||||
]);
|
||||
|
||||
expect(artists.map((artist) => artist.name)).toEqual(["Mara Venn", "North Window"]);
|
||||
expect(artists[1]).toMatchObject({ albumCount: 2 });
|
||||
expect(artists[1].tracks).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user