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
@@ -23,6 +23,10 @@ console.warn = (...args) => {
};
import { resetMockDb } from './__mocks__/firebase/_mock-db';
// Tell React this is an act environment. Without it, every act() call
// emits 'current testing environment is not configured to support act'.
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
// polyfill crypto.randomUUID for jsdom (used by generateId in App.js).
if (!global.crypto) global.crypto = {};
if (!global.crypto.randomUUID) {