Skip to content

Instantly share code, notes, and snippets.

@AnubhavUjjawal
Created September 7, 2019 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnubhavUjjawal/429ee2a00045033d13f06a69b818b15a to your computer and use it in GitHub Desktop.
Save AnubhavUjjawal/429ee2a00045033d13f06a69b818b15a to your computer and use it in GitHub Desktop.
Output of yarn run test
anubhavujjawal@Anubhavs-MacBook-Air  ~/Desktop/work/topcoder/mockup-server   master  yarn run test
yarn run v1.16.0
$ NODE_ENV=test nyc mocha src/tests/**/*.js --exit
JSON Server is running on port 3000
Generators Tests
getUsers
✓ should return array of Users having length and password as passed in argument.
getApplicationIds
✓ should return array of uuids having length as passed in argument.
getLocations
✓ should return array of Locations having length and prefix as passed in argument.
getOrderNumbers
✓ should return array of orderNumbers having length as passed in argument.
getItemNumbers
✓ should return array of itemNumbers having length as passed in argument.
getDevices
✓ should return array of devices having length as passed in argument.
GET /configuredDevices/
✓ should give UnAuthorized 401 error without Authentication Header (40ms)
✓ should return an object of summary of devices. (73ms)
GET /devices/
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return 200 with list of devices. (254ms)
GET /devices/<id>
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return 200 with device object.
GET /itemNumbers/
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return 200 with list of itemNumbers.
GET /locate/
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return 200 with list of devices.
GET /orderNumbers/
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return 200 with list of orderNumbers.
GET /devices/:deviceId/configure/:stepNumber
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return Success/Error when current details passed
Users
POST /users/get-token
✓ should return UnAuthorized 401 when applicationId is missing
✓ should return UnAuthorized 401 when user is missing
✓ should return UnAuthorized 401 when password is missing
✓ should return UnAuthorized 401 when incorrect username
✓ should return UnAuthorized 401 when incorrect applicationId
✓ should return UnAuthorized 401 when incorrect password
✓ should return token with 200 status when correct data passed
PUT, PATCH, POST, DELETE /users should give 405 status
✓ PUT should give 405 error
✓ PATCH should give 405 error
✓ POST should give 405 error
✓ DELETE should give 405 error
GET /users
✓ should give UnAuthorized 401 error without Authentication Header
✓ should return user when current details passed
POST /users/refresh-token should return a new token
✓ POST returns new token
✓ should return 401 status if invalid token
✓ should return 401 status if token user and user dont match
36 passing (576ms)
---------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---------------------------|----------|----------|----------|----------|-------------------|
All files | 99.79 | 93.33 | 100 | 99.79 | |
src | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
src/data-generators | 100 | 100 | 100 | 100 | |
applicationId.js | 100 | 100 | 100 | 100 | |
devices.js | 100 | 100 | 100 | 100 | |
items.js | 100 | 100 | 100 | 100 | |
location.js | 100 | 100 | 100 | 100 | |
orders.js | 100 | 100 | 100 | 100 | |
user.js | 100 | 100 | 100 | 100 | |
src/db | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
src/middlewares | 94.74 | 75 | 100 | 94.74 | |
auth.js | 92.31 | 50 | 100 | 92.31 | 10 |
validation.js | 100 | 100 | 100 | 100 | |
src/routes | 100 | 100 | 100 | 100 | |
configure.js | 100 | 100 | 100 | 100 | |
user.js | 100 | 100 | 100 | 100 | |
src/tests/data-generators | 100 | 100 | 100 | 100 | |
tests.js | 100 | 100 | 100 | 100 | |
src/tests/json-server | 100 | 100 | 100 | 100 | |
device-list-summary.js | 100 | 100 | 100 | 100 | |
devices.js | 100 | 100 | 100 | 100 | |
item-numbers.js | 100 | 100 | 100 | 100 | |
locate.js | 100 | 100 | 100 | 100 | |
order-numbers.js | 100 | 100 | 100 | 100 | |
src/tests/routes | 100 | 100 | 100 | 100 | |
configure.js | 100 | 100 | 100 | 100 | |
users.js | 100 | 100 | 100 | 100 | |
src/utils | 100 | 100 | 100 | 100 | |
auth.js | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
---------------------------|----------|----------|----------|----------|-------------------|
✨ Done in 7.01s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment