diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index 5d76604..f954f25 100644 --- a/tests/wiring.test.mjs +++ b/tests/wiring.test.mjs @@ -90,3 +90,12 @@ test('a hit frame emits a completion marker after the rest of scene update runs' assert.match(source, /const hadQueuedPlayerHit = this\.pendingPlayerHits\.length > 0/); assert.match(source, /this\.checkGameState\(\);[\s\S]*?combat:post-hit-frame-complete/); }); + +test('player hit FX runs after queued hit processing, outside the overlap callback', async () => { + const source = await read('src/game-v4.js'); + + assert.match(source, /this\.pendingPlayerHits\.push\(\{[\s\S]*?x: shot\.x,[\s\S]*?y: shot\.y/); + assert.match(source, /if \(result\.appliedHits > 0\) \{[\s\S]*?this\.spawnExplosion\(impact\.x, impact\.y, 0\.32\)/); + assert.match(source, /this\.flashShip\(this\.player, 0xffcccc\)/); + assert.match(source, /combat:player-hit-fx-error/); +});