test: kill act env warnings + remove debug console noise

Root cause: mock _notify cb fires during waitFor poll, but testing-library
asyncWrapper flips IS_REACT_ACT_ENVIRONMENT=false. Raw react act() then
warns 'not configured to support act' (146 warnings).

Fix: _notify sets globalThis.IS_REACT_ACT_ENVIRONMENT=true around act(),
restores after. setupTests sets flag globally. Both together = 0 warnings.

Also:
- Remove 4 debug console.log from App.js (encounter start/end, drag, add chars)
- Remove always-fires scenario summary console.log
- Add fastWaitFor helper (5ms poll) to testHelpers
- Swap scenario waitFor -> fastWaitFor

Tests: 77 pass / 0 fail / 0 warnings / 0 console noise.
This commit is contained in:
david raistrick
2026-07-03 15:59:14 -04:00
parent 530aaadf90
commit 31d19c5912
5 changed files with 40 additions and 30 deletions
-4
View File
@@ -928,7 +928,6 @@ function ParticipantManager({ encounter, encounterPath, campaignCharacters }) {
await storage.updateDoc(encounterPath, {
participants: [...participants, ...newParticipants]
});
console.log(`Added ${newParticipants.length} characters to the encounter.`);
} catch (err) {
console.error("Error adding all campaign characters:", err);
alert("Failed to add all characters. Please try again.");
@@ -1234,7 +1233,6 @@ function ParticipantManager({ encounter, encounterPath, campaignCharacters }) {
const targetItem = currentParticipants[targetIndex];
if (draggedItem.initiative !== targetItem.initiative) {
console.log("Drag-drop only allowed for participants with same initiative.");
setDraggedItemId(null);
return;
}
@@ -1720,7 +1718,6 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) {
turnOrderIds: [...(encounter.turnOrderIds || [])],
},
});
console.log("Encounter started and set as active display.");
} catch (err) {
console.error("Error starting encounter:", err);
alert("Failed to start encounter. Please try again.");
@@ -1851,7 +1848,6 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) {
turnOrderIds: [...(encounter.turnOrderIds || [])],
},
});
console.log("Encounter ended and deactivated from Player Display.");
} catch (err) {
console.error("Error ending encounter:", err);
}