Commit Graph

2 Commits

Author SHA1 Message Date
jozamudi 1af068923b Improve unit tests with mocking, edge cases, and better coverage
- Add deterministic mocking for Math.random() in garbage tests
- Add edge case tests for piece positioning at boundaries
- Add tests for negative Y positions (spawn area)
- Improve lockPieceToBoard tests with proper I piece shape handling
- Add performance tests for checkBoardOverflow and createEmptyBoard
- Add tests for multiple garbage rows and board overflow scenarios
- Fix test expectations to match actual game logic behavior
- Total tests increased from 57 to 105
2026-03-21 15:22:11 +00:00
jozamudi 80f59fd3b3 Add unit and integration tests for garbage system
- Extract pure game logic functions to game-logic.js for testability
- Add Jest testing framework with 57 tests covering:
  * Unit tests for pure functions (createEmptyBoard, checkBoardOverflow, etc.)
  * Integration tests for garbage system (addGarbageToPlayer, sendGarbage)
  * Socket.io integration tests for multiplayer flow
- Refactor index.js to use extracted functions
- Tests verify garbage elimination bug fix: players only eliminated when board overflows
2026-03-21 08:55:23 +00:00