@@ -1015,55 +1015,64 @@ layer("GitLabPullRequestCli.layer", (it) => {
10151015 } ) ,
10161016 ) ;
10171017
1018- it . effect ( "shows a failed child pipeline that left the head pipeline green" , ( ) =>
1019- Effect . gen ( function * ( ) {
1020- mockedExecute
1021- . mockReturnValueOnce (
1022- Effect . succeed (
1023- output (
1024- mergeRequestJson ( {
1025- // A fork's pipeline runs in the source project, so its id is not the target's.
1026- head_pipeline : {
1027- id : 31 ,
1028- project_id : 12 ,
1029- status : "success" ,
1030- web_url : "https://gitlab.com/bilal/web/-/pipelines/31" ,
1031- } ,
1032- } ) ,
1018+ it . effect . each ( [ "running" , "failed" ] as const ) (
1019+ "keeps a %s child pipeline advisory when the head pipeline is green" ,
1020+ ( childStatus ) =>
1021+ Effect . gen ( function * ( ) {
1022+ mockedExecute
1023+ . mockReturnValueOnce (
1024+ Effect . succeed (
1025+ output (
1026+ mergeRequestJson ( {
1027+ // A fork's pipeline runs in the source project, so its id is not the target's.
1028+ head_pipeline : {
1029+ id : 31 ,
1030+ project_id : 12 ,
1031+ status : "success" ,
1032+ web_url : "https://gitlab.com/bilal/web/-/pipelines/31" ,
1033+ } ,
1034+ } ) ,
1035+ ) ,
10331036 ) ,
1034- ) ,
1035- )
1036- . mockReturnValueOnce (
1037- Effect . succeed (
1038- output (
1039- JSON . stringify ( [
1040- {
1041- name : "deploy " ,
1042- status : "success" ,
1043- downstream_pipeline : {
1044- status : "failed " ,
1045- web_url : "https://gitlab.com/bilal/web/-/pipelines/32" ,
1037+ )
1038+ . mockReturnValueOnce (
1039+ Effect . succeed (
1040+ output (
1041+ JSON . stringify ( [
1042+ {
1043+ name : "deploy" ,
1044+ status : "success " ,
1045+ downstream_pipeline : {
1046+ status : childStatus ,
1047+ web_url : "https://gitlab.com/bilal/web/-/pipelines/32 " ,
1048+ } ,
10461049 } ,
1047- } ,
1048- { name : "docs" , status : "created" , downstream_pipeline : null } ,
1049- ] ) ,
1050+ { name : "docs" , status : "created" , downstream_pipeline : null } ,
1051+ ] ) ,
1052+ ) ,
10501053 ) ,
1051- ) ,
1052- ) ;
1053- const cli = yield * GitLabPullRequestCli . GitLabPullRequestCli ;
1054+ ) ;
1055+ const cli = yield * GitLabPullRequestCli . GitLabPullRequestCli ;
10541056
1055- const detail = yield * cli . getMergeRequestDetail ( {
1056- cwd : "/w" ,
1057- repository : "acme/web" ,
1058- number : 7 ,
1059- } ) ;
1057+ const detail = yield * cli . getMergeRequestDetail ( {
1058+ cwd : "/w" ,
1059+ repository : "acme/web" ,
1060+ number : 7 ,
1061+ } ) ;
10601062
1061- expect ( detail . checks . map ( ( check ) => [ check . name , check . status , check . url ] ) ) . toEqual ( [
1062- [ "Pipeline" , "success" , "https://gitlab.com/bilal/web/-/pipelines/31" ] ,
1063- [ "deploy" , "failure" , "https://gitlab.com/bilal/web/-/pipelines/32" ] ,
1064- ] ) ;
1065- expect ( argsOfCall ( 1 ) [ 1 ] ) . toBe ( "projects/12/pipelines/31/bridges?per_page=100" ) ;
1066- } ) ,
1063+ expect (
1064+ detail . checks . map ( ( check ) => [ check . name , check . status , check . url , check . required ] ) ,
1065+ ) . toEqual ( [
1066+ [ "Pipeline" , "success" , "https://gitlab.com/bilal/web/-/pipelines/31" , true ] ,
1067+ [
1068+ "deploy" ,
1069+ childStatus === "running" ? "pending" : "failure" ,
1070+ "https://gitlab.com/bilal/web/-/pipelines/32" ,
1071+ false ,
1072+ ] ,
1073+ ] ) ;
1074+ expect ( argsOfCall ( 1 ) [ 1 ] ) . toBe ( "projects/12/pipelines/31/bridges?per_page=100" ) ;
1075+ } ) ,
10671076 ) ;
10681077
10691078 it . effect ( "keeps the one pipeline check when the trigger jobs cannot be read whole" , ( ) =>
0 commit comments