This pull request introduces several enhancements and fixes across various modules to improve server handling, response clarity, error handling, and integration of controllers with API endpoints.
Changes
quizUnit.test.js
Added after code block to close the server after tests are completed.
Imported createMockServer, testDB, and mockUserRoutes for setting up the mock server and routes.
Defined existingUser from the test database and a newUser object for testing purposes.
registerUser: Tests user registration and verifies the responses to ensure the user is correctly registered with the expected properties.
loginUser: Tests user login and verifies the responses to ensure the user is correctly logged in with the expected properties.
Implemented expected error handling behavior in test cases.
mockUserController.js
Implemented response and error handling in authentication functions.
Updated response message in registerUser function for improved clarity.
mockUserRoutes.js
Integrated controller functions into their respective API endpoints.
Testing
Verified that the server closes correctly after tests in quizUnit.test.js.
Checked response and error handling in mockUserController.js.
Ensured that controller functions are correctly integrated with API endpoints in mockUserRoutes.js.
Additional Information
The changes aim to enhance code maintainability, improve clarity of response messages, and ensure robust error handling.
PR Description
Summary
This pull request introduces several enhancements and fixes across various modules to improve server handling, response clarity, error handling, and integration of controllers with API endpoints.
Changes
quizUnit.test.js
after
code block to close the server after tests are completed.createMockServer
,testDB
, andmockUserRoutes
for setting up the mock server and routes.existingUser
from the test database and anewUser
object for testing purposes.mockUserController.js
registerUser
function for improved clarity.mockUserRoutes.js
Testing
quizUnit.test.js
.mockUserController.js
.mockUserRoutes.js
.Additional Information