The first public release of Fabled Minstrel #158
@@ -445,16 +445,23 @@ func TestBuildSystemPlaylists_DailyNonceDeterminism(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// snapshotSystemTracks returns a per-playlist-name → []track_id mapping
|
||||
// for the user's system playlists, in playlist_tracks position order.
|
||||
// snapshotSystemTracks returns a per-mix → []track_id mapping for the
|
||||
// user's system playlists, in playlist_tracks position order.
|
||||
//
|
||||
// A mix is keyed by its name AND its seed artist, because names are not
|
||||
// unique: two artists can share a name (the test fixtures make one artist
|
||||
// row per track, all named alike), and their Songs like mixes are then
|
||||
// both called "Songs like X". Keyed by name alone, two such mixes merge
|
||||
// into one list whose interleaving is whatever order Postgres returns the
|
||||
// tied rows in, and the snapshot varies even when the mixes do not.
|
||||
func snapshotSystemTracks(t *testing.T, pool *pgxpool.Pool, userID pgtype.UUID) map[string][]string {
|
||||
t.Helper()
|
||||
rows, err := pool.Query(context.Background(), `
|
||||
SELECT p.name, pt.track_id
|
||||
SELECT p.name || ' [' || COALESCE(p.seed_artist_id::text, '-') || ']', pt.track_id
|
||||
FROM playlists p
|
||||
JOIN playlist_tracks pt ON pt.playlist_id = p.id
|
||||
WHERE p.user_id = $1 AND p.kind = 'system'
|
||||
ORDER BY p.name, pt.position
|
||||
ORDER BY p.name, p.seed_artist_id, pt.position
|
||||
`, userID)
|
||||
if err != nil {
|
||||
t.Fatalf("snapshot query: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user