diff --git a/internal/playlists/genre_mixes_db_test.go b/internal/playlists/genre_mixes_db_test.go index 1a8fab72..11cc0d90 100644 --- a/internal/playlists/genre_mixes_db_test.go +++ b/internal/playlists/genre_mixes_db_test.go @@ -15,13 +15,18 @@ import ( ) // seedGenre creates artists × perArtist tracks tagged genre, each artist on -// its own album, and returns the tracks. +// its own album, and returns the tracks. seedTrack mints a new artist on +// every call (an artist without an mbid has no conflict key), so each +// artist's first track creates it and the rest join that track's album. func seedGenre(t *testing.T, pool *pgxpool.Pool, genre string, artists, perArtist int) []dbq.Track { t.Helper() var out []dbq.Track for a := 0; a < artists; a++ { - for k := 0; k < perArtist; k++ { - tr := seedTrack(t, pool, fmt.Sprintf("%s %d-%d", genre, a, k), fmt.Sprintf("%s Artist %d", genre, a)) + first := seedTrack(t, pool, fmt.Sprintf("%s %d-0", genre, a), fmt.Sprintf("%s Artist %d", genre, a)) + setGenre(t, pool, first.ID, genre) + out = append(out, first) + for k := 1; k < perArtist; k++ { + tr := seedTrackForArtist(t, pool, fmt.Sprintf("%s %d-%d", genre, a, k), first.AlbumID, first.ArtistID) setGenre(t, pool, tr.ID, genre) out = append(out, tr) }