@@ -333,9 +333,14 @@ it.effect("does not verify a paused credential over the network and resumes afte
333333 } ) ,
334334) ;
335335
336- it . effect . each ( [ false , true ] ) (
337- "pins workspace credentials for concurrent summaries, fallback=%s" ,
338- ( fallback ) =>
336+ it . effect . each ( [
337+ [ "github.com" , false ] ,
338+ [ "github.com" , true ] ,
339+ [ "github.example" , false ] ,
340+ [ "github.example" , true ] ,
341+ ] as const ) (
342+ "pins workspace credentials for concurrent summaries, host and fallback=%s" ,
343+ ( [ host , fallback ] ) =>
339344 Effect . gen ( function * ( ) {
340345 const commands : VcsProcess . VcsProcessInput [ ] = [ ] ;
341346 const github = yield * GitHubCli . make . pipe (
@@ -347,7 +352,9 @@ it.effect.each([false, true])(
347352 const token = input . cwd === "/b" ? "token-b" : "token-a" ;
348353 if ( input . args [ 0 ] === "auth" ) return output ( token ) ;
349354 if ( input . args [ 1 ] === "user" ) return output ( '{"id":123,"login":"same-viewer"}' ) ;
350- if ( input . args . includes ( "rate_limit" ) ) {
355+ if (
356+ input . args . includes ( "query=query { rateLimit { cost limit remaining resetAt } }" )
357+ ) {
351358 expect ( [ "token-a" , "token-b" ] ) . toContain ( input . env ?. GH_TOKEN ) ;
352359 return output (
353360 encodeJson ( {
@@ -384,6 +391,9 @@ it.effect.each([false, true])(
384391 } ) ,
385392 ) ;
386393 const query = input . args . find ( ( arg ) => arg . startsWith ( "query=" ) ) ?? "" ;
394+ expect ( query . includes ( "stack { number size baseRefName }" ) ) . toBe (
395+ host === "github.com" ,
396+ ) ;
387397 const data : Record < string , unknown > = { } ;
388398 for ( const match of query . matchAll (
389399 / ( s \d + ) : r e p o s i t o r y \( o w n e r : " ( [ ^ " ] + ) " , n a m e : " ( [ ^ " ] + ) " \) \{ p u l l R e q u e s t \( n u m b e r : ( \d + ) \) / g,
@@ -402,6 +412,7 @@ it.effect.each([false, true])(
402412 closedAt : null ,
403413 reviewDecision : null ,
404414 mergeable : "MERGEABLE" ,
415+ ...( host === "github.com" ? { stack : null } : { } ) ,
405416 } ,
406417 } ;
407418 }
@@ -419,14 +430,26 @@ it.effect.each([false, true])(
419430 cli . getPullRequestSummary ( {
420431 cwd : `/${ name } ` ,
421432 repository : `${ name } /repo` ,
422- host : "github.com" ,
433+ host,
423434 number : index + 1 ,
424435 } ) ,
425436 { concurrency : "unbounded" } ,
426437 ) . pipe ( Effect . forkChild ) ;
427438 yield * TestClock . adjust ( "100 millis" ) ;
428- expect ( ( yield * Fiber . join ( reads ) ) . map ( ( row ) => row . number ) ) . toEqual ( [ 1 , 2 , 3 , 4 ] ) ;
429- expect ( commands . filter ( ( command ) => command . args [ 1 ] === "graphql" ) ) . toHaveLength ( 2 ) ;
439+ const summaries = yield * Fiber . join ( reads ) ;
440+ expect ( summaries . map ( ( row ) => row . number ) ) . toEqual ( [ 1 , 2 , 3 , 4 ] ) ;
441+ if ( ! fallback ) {
442+ expect ( summaries . map ( ( row ) => row . stack ) ) . toEqual (
443+ host === "github.com"
444+ ? [ null , null , null , null ]
445+ : [ undefined , undefined , undefined , undefined ] ,
446+ ) ;
447+ }
448+ expect (
449+ commands . filter ( ( command ) =>
450+ command . args . some ( ( arg ) => arg . startsWith ( "query=query PullRequestSummaries" ) ) ,
451+ ) ,
452+ ) . toHaveLength ( 2 ) ;
430453 expect ( commands . filter ( ( command ) => command . args [ 0 ] === "auth" ) ) . toHaveLength ( 3 ) ;
431454 expect ( commands . filter ( ( command ) => command . args [ 0 ] === "pr" ) ) . toHaveLength ( fallback ? 4 : 0 ) ;
432455 } ) ,
0 commit comments