test(bot): add spec coverage for /session
Merged
LU
1mo ago+465+465+012345678901234567890123456789-0-0-0123456789
Summary
packages/bot/src/functions/music/commands/session.ts (258 LOC) had no spec while every sibling music command does. /album shipped 100% broken for every text query and stayed that way until #2053 precisely because it had no spec either (#2050) - same risk class here.
Coverage added
- save: no-active-queue warning, name lowercasing, the service's duplicate/invalid/limit refusal, and success
- list: empty state and the formatted per-session line
- delete: found/not-found, and that it skips the voice-channel guard restore needs
- restore: voice-channel guard, reusing vs creating a queue, the queueConnect failure path, the zero-restored-tracks not-found case, and success
Test plan
-
npx jest src/functions/music/commands/session.spec.ts- 16/16 pass - Verified each assertion actually fails against a mutated implementation (forced branches to always/never take the no-queue and delete-found paths, forced restore to always create a fresh queue) before confirming it passes against the real code - the same check that would have caught #2050
-
npx tsc -p packages/bot --noEmitclean - No production code changed - test-only PR
Closes #2057
Summary by cubic
Adds the missing spec for the /session music command so it has the same regression protection as sibling commands, closing #2057. Test-only PR with no production code changes.
Coverage
save: warns without an active queue, lowercases the session name, handles the service's duplicate/invalid/limit refusal, and reports success.list: covers the empty state and the formatted per-session line.delete: covers found, not-found, and that it skips the voice-channel guardrestoreneeds.restore: covers the voice-channel guard, queue creation vs reuse, thequeueConnectfailure path, the zero-restored-tracks not-found case, and success.- Every assertion was verified to fail against a mutated implementation before passing against the real code.