@@ -665,4 +665,46 @@ describe('challenge type API E2E tests', () => {
665665 should . equal ( response . body . message , '"legacyId" must be a number' )
666666 } )
667667 } )
668+
669+ describe ( 'remove challenge type API tests' , ( ) => {
670+ it ( 'remove challenge type - forbidden' , async ( ) => {
671+ const response = await chai . request ( app )
672+ . delete ( `${ basePath } /${ id } ` )
673+ . set ( 'Authorization' , `Bearer ${ config . USER_TOKEN } ` )
674+ should . equal ( response . status , 403 )
675+ should . equal ( response . body . message , 'You are not allowed to perform this action!' )
676+ } )
677+
678+ it ( 'remove challenge type successfully' , async ( ) => {
679+ const response = await chai . request ( app )
680+ . delete ( `${ basePath } /${ id } ` )
681+ . set ( 'Authorization' , `Bearer ${ config . ADMIN_TOKEN } ` )
682+ should . equal ( response . status , 200 )
683+ should . equal ( response . body . id , id )
684+ } )
685+
686+ it ( 'remove challenge type - not found 1' , async ( ) => {
687+ const response = await chai . request ( app )
688+ . delete ( `${ basePath } /${ id } ` )
689+ . set ( 'Authorization' , `Bearer ${ config . ADMIN_TOKEN } ` )
690+ should . equal ( response . status , 404 )
691+ should . equal ( response . body . message , `ChallengeType with id: ${ id } doesn't exist` )
692+ } )
693+
694+ it ( 'remove challenge type - not found 2' , async ( ) => {
695+ const response = await chai . request ( app )
696+ . delete ( `${ basePath } /${ notFoundId } ` )
697+ . set ( 'Authorization' , `Bearer ${ config . ADMIN_TOKEN } ` )
698+ should . equal ( response . status , 404 )
699+ should . equal ( response . body . message , `ChallengeType with id: ${ notFoundId } doesn't exist` )
700+ } )
701+
702+ it ( 'remove challenge type - invalid id' , async ( ) => {
703+ const response = await chai . request ( app )
704+ . delete ( `${ basePath } /invalid` )
705+ . set ( 'Authorization' , `Bearer ${ config . ADMIN_TOKEN } ` )
706+ should . equal ( response . status , 400 )
707+ should . equal ( response . body . message , '"challengeTypeId" must be a valid GUID' )
708+ } )
709+ } )
668710} )
0 commit comments