tests: reorderParticipants characterization + BUG-6 RED
turn.reorder.test.js: 4 green (swaps, throws-diff-init, throws-missing-id, documents current no-turnOrderIds-touch) + 1 RED (BUG-6: should update turnOrderIds to reflect new order). Found: reorderParticipants changes participants[] array but not turnOrderIds. nextTurn rotates via turnOrderIds only → mid-combat drag-drop = no effect. replay-combat.js calls with wrong signature (swallowed by try/catch), so real path never exercised either. TODO: BUG-6 added.
This commit is contained in:
@@ -79,6 +79,18 @@
|
||||
sequence exactly (damage, heal, conditions, toggleActive, deathSave,
|
||||
remove, add, edit, pause/resume, reorder, revive-between-rounds).
|
||||
|
||||
### BUG-6: reorderParticipants doesn't update turnOrderIds
|
||||
- Test: `shared/tests/turn.reorder.test.js` 'reorder updates turnOrderIds' (RED).
|
||||
- `reorderParticipants(enc, draggedId, targetId)` swaps two same-initiative
|
||||
participants in `participants[]` array but leaves `turnOrderIds` unchanged.
|
||||
- nextTurn rotates via `turnOrderIds` only → reorder has NO effect on combat
|
||||
rotation. Mid-encounter drag-drop = pointless.
|
||||
- replay-combat.js calls reorderParticipants with WRONG signature
|
||||
`(enc, reorderedArray)` — swallowed by try/catch, silent no-op. So
|
||||
replay never exercised real path either.
|
||||
- Fix: reorder must also update turnOrderIds to match new participant order
|
||||
(within same-initiative tie).
|
||||
|
||||
## Pipeline
|
||||
- [ ] Red test: dead participant still in turnOrderIds, turn still advances to them
|
||||
- [ ] Fix `shared/turn.js`: don't drop dead from turn order
|
||||
|
||||
Reference in New Issue
Block a user