mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
test(playerStore): characterize pure helpers + queue mutations (Phase F1 / PR 2a) (#540)
trackShape.test.ts: songToTrack mapping (required, optional, replayGain flattening, missing-block fallback, no invented flags); resolveReplayGainDb precedence (disabled, track, album, auto with prev/next neighbour match, missing albumId fallback, both gains missing); shuffleArray (non-mutating, preserves multiset, copies, empty/single, deterministic under mocked RNG). queue.test.ts: enqueue / enqueueAt (auto-added separator placement, queueIndex shift, index clamping), playNext (playNextAdded tag, position, empty input), clearQueue (state reset, audio_stop call), reorderQueue (splice, currentTrack-id-following queueIndex), removeTrack (clamp on shrink, keep when after cursor), undo / redo (empty stacks return false, rollback, replay, new edit drops pending redo). Adds a 5-line test-only export _resetQueueUndoStacksForTest in playerStore.ts because the undo/redo arrays live at module scope outside the Zustand state graph; storeReset.ts now calls it so resetPlayerStore is fully complete. playerStore.ts coverage 4.76% -> 18.1% lines. PR 2b + 2c push further toward the F1 floor of 50%.
This commit is contained in:
committed by
GitHub
parent
4f9ad07d65
commit
42e3fdb976
@@ -457,6 +457,12 @@ type QueueUndoSnapshot = {
|
||||
const queueUndoStack: QueueUndoSnapshot[] = [];
|
||||
const queueRedoStack: QueueUndoSnapshot[] = [];
|
||||
|
||||
/** Test-only: clears module-scoped undo/redo stacks so each test starts clean. */
|
||||
export function _resetQueueUndoStacksForTest(): void {
|
||||
queueUndoStack.length = 0;
|
||||
queueRedoStack.length = 0;
|
||||
}
|
||||
|
||||
/** QueuePanel registers a reader so undo snapshots capture list scroll position. */
|
||||
let queueListScrollTopReader: (() => number | undefined) | null = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user