fix(web): user-playlist play omits third arg to satisfy contract test
test-web / test (push) Successful in 35s
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:
@@ -86,10 +86,17 @@
|
|||||||
const detail = await getPlaylist(playlist.id);
|
const detail = await getPlaylist(playlist.id);
|
||||||
const refs = toTrackRefs(detail.tracks);
|
const refs = toTrackRefs(detail.tracks);
|
||||||
if (refs.length > 0) {
|
if (refs.length > 0) {
|
||||||
// Tag the queue with the variant when one exists so play
|
// Per-artist system mixes (songs_like_artist) carry a
|
||||||
// events still carry the correct source attribution even
|
// variant tag so play_started still attributes the source
|
||||||
// though we went through the per-id path.
|
// correctly even though we routed through the per-id path.
|
||||||
playQueue(refs, 0, variant != null ? { source: variant } : undefined);
|
// 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 {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user