@@ -617,3 +617,27 @@ test.serial("Publish a release with an asset link", async (t) => {
617617 t . deepEqual ( t . context . log . args [ 0 ] , [ "Published GitLab release: %s" , nextRelease . gitTag ] ) ;
618618 t . true ( gitlab . isDone ( ) ) ;
619619} ) ;
620+
621+ test . serial ( "Publish a release with error response" , async ( t ) => {
622+ const owner = "test_user" ;
623+ const repo = "test_repo" ;
624+ const env = { GITLAB_TOKEN : "gitlab_token" } ;
625+ const pluginConfig = { } ;
626+ const nextRelease = { gitHead : "123" , gitTag : "v1.0.0" , notes : "Test release note body" } ;
627+ const options = { repositoryUrl : `https://gitlab.com/${ owner } /${ repo } .git` } ;
628+ const encodedRepoId = encodeURIComponent ( `${ owner } /${ repo } ` ) ;
629+ const encodedGitTag = encodeURIComponent ( nextRelease . gitTag ) ;
630+ const gitlab = authenticate ( env )
631+ . post ( `/projects/${ encodedRepoId } /releases` , {
632+ tag_name : nextRelease . gitTag ,
633+ description : nextRelease . notes ,
634+ assets : {
635+ links : [ ] ,
636+ } ,
637+ } )
638+ . reply ( 499 , { message : "Something went wrong" } ) ;
639+
640+ const error = await t . throwsAsync ( publish ( pluginConfig , { env, options, nextRelease, logger : t . context . logger } ) ) ;
641+ t . is ( error . message , `Response code 499 (Something went wrong)` ) ;
642+ t . true ( gitlab . isDone ( ) ) ;
643+ } ) ;
0 commit comments