File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ const archiveMembers = async (req, res) => {
115
115
return res . boom . notFound ( "User doesn't exist" ) ;
116
116
} catch ( err ) {
117
117
logger . error ( `Error while retriving contributions ${ err } ` ) ;
118
- return res . status ( 500 ) . json ( { message : INTERNAL_SERVER_ERROR } ) ;
118
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
119
119
}
120
120
} ;
121
121
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const config = require("config");
14
14
const cookieName = config . get ( "userToken.cookieName" ) ;
15
15
const Sinon = require ( "sinon" ) ;
16
16
const { INTERNAL_SERVER_ERROR } = require ( "../../constants/errorMessages" ) ;
17
- const dataAccess = require ( "../.././services/dataAccessLayer " ) ;
17
+ const members = require ( "../../models/members " ) ;
18
18
19
19
chai . use ( chaiHttp ) ;
20
20
@@ -271,20 +271,22 @@ describe("Members", function () {
271
271
await cleanDb ( ) ;
272
272
} ) ;
273
273
it ( "Should return an object with status 500 and an error message" , function ( done ) {
274
- dataAccessStub = Sinon . stub ( dataAccess , "retrieveUsers " ) ;
274
+ dataAccessStub = Sinon . stub ( members , "addArchiveRoleToMembers " ) ;
275
275
dataAccessStub . throws ( new Error ( INTERNAL_SERVER_ERROR ) ) ;
276
+
276
277
addUser ( userToBeArchived ) . then ( ( ) => {
277
278
chai
278
279
. request ( app )
279
280
. patch ( `/members/archiveMembers/${ userToBeArchived . username } ` )
280
- . set ( "Cookie " , `${ cookieName } =${ jwt } ` )
281
+ . set ( "cookie " , `${ cookieName } =${ jwt } ` )
281
282
. send ( { reason : "some reason" } )
282
283
. end ( ( err , res ) => {
283
284
if ( err ) {
284
285
return done ( err ) ;
285
286
}
286
287
expect ( res ) . to . have . status ( 500 ) ;
287
- expect ( res . body . message ) . to . be . equal ( INTERNAL_SERVER_ERROR ) ;
288
+ expect ( res . body ) . to . be . a ( "object" ) ;
289
+ expect ( res . body . message ) . to . equal ( INTERNAL_SERVER_ERROR ) ;
288
290
return done ( ) ;
289
291
} ) ;
290
292
} ) ;
You can’t perform that action at this time.
0 commit comments