Update documentation for testing infrastructure
- Add test commands to CLAUDE.md and README.md - Update file structure to include game-logic.js and __tests__/ - Document Jest test suite with 57 tests
This commit is contained in:
@@ -17,6 +17,12 @@ cd server && npm start
|
||||
# or
|
||||
cd server && node index.js
|
||||
|
||||
# Run tests
|
||||
cd server && npm test
|
||||
|
||||
# Run tests with coverage
|
||||
cd server && npm run test:coverage
|
||||
|
||||
# Server runs on http://localhost:3000 (or PORT env variable)
|
||||
```
|
||||
|
||||
@@ -24,11 +30,13 @@ cd server && node index.js
|
||||
|
||||
### Server-Client Model
|
||||
|
||||
- **Server** (`server/index.js`): Express + Socket.io handles all game logic authoritatively
|
||||
- **Server** (`server/`): Express + Socket.io handles all game logic authoritatively
|
||||
- `index.js`: Main server with socket.io event handlers
|
||||
- `game-logic.js`: Pure game logic functions (testable, no socket dependencies)
|
||||
- `__tests__/`: Jest test suite with 57 tests
|
||||
- Manages single global lobby with `lobby.players` Map
|
||||
- Game tick runs at 50ms intervals via `gameTick()`
|
||||
- Broadcasts state updates to all connected clients via `broadcastState()`
|
||||
- Tetromino definitions and board constants are duplicated on server
|
||||
|
||||
- **Client** (`public/js/`): Vanilla JavaScript with module pattern
|
||||
- `network.js`: Socket.io client wrapper, manages player/game state caching
|
||||
|
||||
Reference in New Issue
Block a user