Skip to content

Add socket handler tests for all events #8

@dennisthemenacing

Description

@dennisthemenacing

The GameManager has solid unit test coverage (src/gameManager/tests/index.test.ts), but the socket layer in src/sockets/chessSockets.ts has no corresponding integration tests.\n\nThe socket handlers wrap GameManager methods and handle Socket.io event emission. Without tests, we can't verify:\n- Correct event emission on game actions\n- Error handling propagation through the socket layer\n- The sanitization logic in emitGame and sanitizeGames\n\nProposed scope:\n- Add src/sockets/tests/chessSockets.test.ts\n- Test each event handler: createGame, joinGame, resign, offerDraw, acceptDraw, makeMove, requestLobby\n- Mock the Socket instance and verify correct events are emitted\n- Test error paths and edge cases (e.g., acting on concluded games)\n\nThis is a good first issue since the GameManager tests already define expected behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions