@@ -40,6 +40,14 @@ describe('POST /auth/login', () => {
4040 } )
4141} )
4242
43+ describe ( 'GET /users' , ( ) => {
44+ it ( 'should return 200' , async ( ) => {
45+ let response = await chai . request ( server ) . get ( `/api/users` ) . send ( )
46+ expect ( response ) . to . have . status ( 200 )
47+ expect ( response . body . data . users ) . to . be . a ( 'array' ) . of . length ( 1 )
48+ } )
49+ } )
50+
4351describe ( 'GET /auth/profile' , ( ) => {
4452 it ( 'should return 200' , async ( ) => {
4553 let response = await chai . request ( server ) . get ( `/api/auth/profile` ) . set ( 'Authorization' , `Bearer ${ token } ` ) . send ( )
@@ -56,6 +64,20 @@ describe('PUT /users/:id', () => {
5664 expect ( response ) . to . have . status ( 200 )
5765 expect ( response . body . message ) . to . be . equal ( 'Record updated' )
5866 } )
67+ } )
68+
69+ describe ( 'GET /auth/login' , ( ) => {
70+ it ( 'should return 404' , async ( ) => {
71+ let response = await chai . request ( server ) . get ( '/api/auth/login' ) . send ( { } )
72+ expect ( response ) . to . have . status ( 404 )
73+ } )
74+ } )
75+
76+ describe ( 'GET /auth/profile' , ( ) => {
77+ it ( 'should return 401' , async ( ) => {
78+ let response = await chai . request ( server ) . get ( `/api/auth/profile` ) . send ( )
79+ expect ( response ) . to . have . status ( 401 )
80+ } )
5981
6082 after ( 'Cleaning users collection' , async function ( ) {
6183 await userModel . findOneAndDelete ( { _id : sampleuserid } )
0 commit comments