-
Notifications
You must be signed in to change notification settings - Fork 7
Testing
Tests /api/auth
.
Tests POST /api/auth/login
.
Tests that the endpoint returns a token on success.
Tests that the endpoint returns a 400 status code when invalid credentials are given.
Tests POST /api/auth/register
.
Tests that the user is successfully added to the database and that the user information is returned.
Tests that a 409 status code is returned when a user with the given email already exists.
Tests company database model.
Tests addCompany()
.
Tests that a company is properly added to the database.
Tests findCompanies()
.
Tests that all companies are properly returned.
Tests findCompaniesById()
.
Tests that company is returned when one exists.
Tests that null is returned when company not found.
Tests findCompanyReviews()
.
Tests that the company's reviews are returned.
Tests updateCompany()
.
Tests that a company is successfully updated.
Tests /api/companies
.
Tests POST /api/companies
.
Tests that the company is returned when successfully added.
Tests GET /api/companies
.
Tests that all companies are returned in the body.
Tests GET /api/companies/:companyId
.
Tests that the company is returned in the body.
Tests middleware.
Tests checkForAdmin middleware.
Tests that the middleware returns 403 if the user isn't an admin.
Tests that the middleware doesn't return 403 if the user is an admin.
Tests checkForCompanyData middleware.
Tests that the middleware returns 400 if a missing field is missing.
Tests that the middleware returns 400 if the body is empty.
Tests checkForLoginData middleware.
Tests that the middleware returns 400 if a missing field is missing.
Tests that the middleware returns 400 if the body is empty.
Tests checkForRegisterData middleware.
Tests that the middleware returns 400 if a missing field is missing.
Tests that the middleware returns 400 if the body is empty.
Tests checkForReviewData middleware.
Tests that the middleware returns 400 if a missing field is missing.
Tests that the middleware returns 400 if the body is empty.
Tests restricted middleware.
Tests that a token is required for endpoints.
Tests validateCompanyById middleware.
Tests that the middleware returns 404 if the company doesn't exist.
Tests validateReviewId middleware.
Tests that the middleware returns 404 if the review doesn't exist.
Tests validateUserById middlware.
Tests that the middleware returns 404 if the user doesn't exist.
Tests review database model.
Tests addReview()
.
Tests that a review is properly added to the database.
Tests deleteReview()
.
Tests that the review is properly deleted from the database.
Tests findReviewById()
.
Tests that the review is returned when found.
Tests that null is returned when no review found.
Tests updateReview()
.
Tests that a review is successfully updated.
Tests /api/reviews
Tests GET /api/reviews
.
Tests that all reviews are returned.
Tests GET /api/reviews/:reviewId
.
Tests that the proper review is returned.
Tests user database model.
Tests addUser()
.
Tests that user is properly added to the database.
Tests that addUser returns the result of findUserById.
Tests that a duplicate user cannot be created.
Tests findUserById()
.
Tests that the user is return when user exists.
Tests that null is return when user doesn't exist.
Tests /api/users
.
Tests POST /api/users/:userId/add-review
.
Tests that the endpoint returns the review created.
Tests PUT /api/users/:userId/bind
Tests that the endpoint returns the update user.
Tests DELETE /api/users/:userId
Tests that the user is successfully deleted.
Tests GET /api/users/all
.
Tests that all users are returned in the body.
Tests GET /api/users/:userId
.
Tests that the user is returned in the body.
Tests PUT /api/users/:userId
.
Tests that updating password hashes it.
Tests that all proper fields can be edited.
Tests that invalid fields are ignored.
Tests that the updated user info is returned.
Tests that a 409 status code is returned when duplicate email is used.