Skip to content

Refactor and Add Tests: Unit Tests #42

@Deadlyflamemaster

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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions