fix(web): user-playlist play omits third arg to satisfy contract test
test-web / test (push) Successful in 35s

74bae74f routed per-artist system mixes through getPlaylist and
always passed the source attribution as the third arg, falling
back to undefined for true user playlists. Vitest's toHaveBeenCalledWith
is arity-strict — playQueue(refs, 0, undefined) is not the same as
playQueue(refs, 0) — so the PlaylistCard contract test failed on
the user-playlist case.

Split the call: pass three args only when a variant tag exists,
two args for user playlists. Preserves source attribution for
songs_like_artist and keeps user playlists source-less as the
test pins.
This commit is contained in:
2026-06-01 23:31:45 -04:00
parent 6a7d9afdbc
commit 6ac36dd334
+11 -4
View File
@@ -86,10 +86,17 @@
const detail = await getPlaylist(playlist.id);
const refs = toTrackRefs(detail.tracks);
if (refs.length > 0) {
// Tag the queue with the variant when one exists so play
// events still carry the correct source attribution even
// though we went through the per-id path.
playQueue(refs, 0, variant != null ? { source: variant } : undefined);
// Per-artist system mixes (songs_like_artist) carry a
// variant tag so play_started still attributes the source
// correctly even though we routed through the per-id path.
// True user playlists (variant == null) call with two args
// so source attribution stays absent — the PlaylistCard
// test pins this contract.
if (variant != null) {
playQueue(refs, 0, { source: variant });
} else {
playQueue(refs, 0);
}
}
}
} finally {