CombatSystem: 30 tests failing - .projectiles.add not a function #2

Open
opened 2026-05-29 23:46:08 +00:00 by kaykayyali · 0 comments
Owner

Problem

npm test shows 30 failing tests, all in CombatSystem:

TypeError: this.projectiles.add is not a function
  at CombatSystem.fireProjectile (src/systems/CombatSystem.js:192:24)

Test stats: 30 failed, 120 passed, 150 total.

Root Cause

this.projectiles is a Phaser Group that should be created in the CombatSystem constructor. The test harness doesn't set up the Phaser Groups properly.

Fix

In src/systems/CombatSystem.js, ensure this.projectiles is initialized as a Phaser Group (with this.scene.physics.add.group() or similar). Then update tests/unit/CombatSystem.test.js to properly create the Group mock.

Verification

  • npm test should pass all 150 tests
  • 0 failures in CombatSystem suite
## Problem `npm test` shows 30 failing tests, all in CombatSystem: ``` TypeError: this.projectiles.add is not a function at CombatSystem.fireProjectile (src/systems/CombatSystem.js:192:24) ``` Test stats: 30 failed, 120 passed, 150 total. ## Root Cause `this.projectiles` is a Phaser Group that should be created in the CombatSystem constructor. The test harness doesn't set up the Phaser Groups properly. ## Fix In `src/systems/CombatSystem.js`, ensure `this.projectiles` is initialized as a Phaser Group (with `this.scene.physics.add.group()` or similar). Then update `tests/unit/CombatSystem.test.js` to properly create the Group mock. ## Verification - `npm test` should pass all 150 tests - 0 failures in CombatSystem suite
kaykayyali added the bugtests labels 2026-05-29 23:46:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kaykayyali/restitution#2