Skip to content

Refactor and Add Tests: Unit Tests #42

Description

@Deadlyflamemaster

Refactor and Add Tests
We'll add the necessary tests for all layers (service, repository, controller), as well as integration tests for client-server and server-database communication.

Unit Tests
Testing the Service Layer (gameService.js):
Tests should cover:

Validating inputs for player names and scores.
Ensuring scores are saved correctly.
Fetching top players for the leaderboard.
Example tests/gameService.test.js

Testing the Repository Layer (playerRepository.js):
Ensure that the repository interacts correctly with the database using MongoDB Memory Server.

Example tests/playerRepository.test.js

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions