Unit Testing
BulletBuzz includes comprehensive unit tests covering all major game systems.
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
Test Structure
Tests are organized by system:
BulletBuzzGame.test.ts
: Main game class testscore/Player.test.ts
: Player character testscore/Enemy.test.ts
: Enemy AI testscore/Axe.test.ts
: Combat system testssystems/CollisionSystem.test.ts
: Collision detection testssystems/LevelSystem.test.ts
: Level progression testssystems/SpawnSystem.test.ts
: Enemy spawning tests
Test Coverage
The test suite covers:
- ✅ Game initialization and state management
- ✅ Player movement and controls
- ✅ Enemy AI and pathfinding
- ✅ Combat mechanics and collision detection
- ✅ Pickup collection and attraction
- ✅ Level progression and shop system
- ✅ Performance monitoring
- ✅ Memory management
Example Test
describe('Player', () => {
it('should move towards target position', () => {
const player = new Player(100, 100);
player.moveTowards(200, 200);
expect(player.x).toBeGreaterThan(100);
expect(player.y).toBeGreaterThan(100);
});
});