@@ -902,6 +902,7 @@ layer("GitLabPullRequestCli.layer", (it) => {
902902 readonly bridges : string | ReadonlyArray < string > ;
903903 } ,
904904 pipeline : Record < string , unknown > = headPipeline ,
905+ mergeRequest : Record < string , unknown > = { } ,
905906 ) {
906907 mockedExecute . mockImplementation ( ( input ) => {
907908 const path = input . args [ 1 ] ?? "" ;
@@ -911,7 +912,9 @@ layer("GitLabPullRequestCli.layer", (it) => {
911912 ? "bridges"
912913 : null ;
913914 if ( kind === null ) {
914- return Effect . succeed ( output ( mergeRequestJson ( { head_pipeline : pipeline } ) ) ) ;
915+ return Effect . succeed (
916+ output ( mergeRequestJson ( { ...mergeRequest , head_pipeline : pipeline } ) ) ,
917+ ) ;
915918 }
916919 const pages = lists [ kind ] ;
917920 const page = Number ( new URLSearchParams ( path . split ( "?" ) [ 1 ] ) . get ( "page" ) ) ;
@@ -1019,6 +1022,22 @@ layer("GitLabPullRequestCli.layer", (it) => {
10191022 } ) ,
10201023 ) ;
10211024
1025+ it . effect ( "keeps a finished pipeline's checks apart from another GitLab's" , ( ) =>
1026+ Effect . gen ( function * ( ) {
1027+ const pipeline = { ...headPipeline , id : 230 } ;
1028+ answer ( { jobs : pageOf ( 1 , 2 ) , bridges : "[]" } , pipeline ) ;
1029+ yield * read ( true ) ;
1030+
1031+ // The same ids on a self-managed GitLab name a different pipeline.
1032+ answer ( { jobs : pageOf ( 1 , 3 ) , bridges : "[]" } , pipeline , {
1033+ web_url : "https://gitlab.example.com/acme/web/-/merge_requests/7" ,
1034+ } ) ;
1035+ const other = yield * read ( true ) ;
1036+ expect ( jobReads ( ) ) . toBe ( 4 ) ;
1037+ expect ( other . checks ) . toHaveLength ( 3 ) ;
1038+ } ) ,
1039+ ) ;
1040+
10221041 it . effect ( "reads a finished pipeline's jobs again after a partial read" , ( ) =>
10231042 Effect . gen ( function * ( ) {
10241043 const pipeline = { ...headPipeline , id : 250 } ;
0 commit comments