@@ -382,13 +382,14 @@ describe("VcsStatusBroadcaster", () => {
382382 ) ;
383383
384384 it . effect ( "refreshes a loaded cwd without reusing a previous branch's PR" , ( ) => {
385- const state = {
385+ const state : Parameters < typeof layerTestFor > [ 0 ] = {
386386 currentLocalStatus : baseLocalStatus ,
387- currentRemoteStatus : baseRemoteStatus ,
387+ currentRemoteStatus : { ... baseRemoteStatus , aheadCount : 3 , behindCount : 5 } ,
388388 localStatusCalls : 0 ,
389389 remoteStatusCalls : 0 ,
390390 localInvalidationCalls : 0 ,
391391 remoteInvalidationCalls : 0 ,
392+ remoteStatusRefreshUpstreamValues : [ ] ,
392393 } ;
393394
394395 return Effect . gen ( function * ( ) {
@@ -400,9 +401,14 @@ describe("VcsStatusBroadcaster", () => {
400401 yield * broadcaster . getStatus ( { cwd : "/repo" } ) ;
401402 assert . equal ( state . remoteStatusCalls , 1 ) ;
402403
403- state . currentRemoteStatus = remoteStatusWithPr ;
404+ state . backgroundWorkEnabled = false ;
405+ state . currentRemoteStatus = { ...remoteStatusWithPr , aheadCount : 7 } ;
404406 const refreshed = yield * broadcaster . refreshPullRequestStatus ( "/repo" ) ;
405- assert . deepStrictEqual ( refreshed , remoteStatusWithPr ) ;
407+ assert . deepStrictEqual ( refreshed , state . currentRemoteStatus ) ;
408+ const merged = yield * broadcaster . getStatus ( { cwd : "/repo" } ) ;
409+ assert . equal ( merged . aheadCount , 7 ) ;
410+ assert . equal ( merged . behindCount , 0 ) ;
411+ assert . equal ( state . remoteStatusRefreshUpstreamValues ?. at ( - 1 ) , false ) ;
406412 assert . equal ( state . remoteStatusCalls , 2 ) ;
407413 assert . equal ( state . remoteInvalidationCalls , 2 ) ;
408414
@@ -944,7 +950,7 @@ describe("VcsStatusBroadcaster", () => {
944950 } ,
945951 ) ;
946952
947- it . effect ( "recovers a discarded branch lookup on the next permitted turn-end refresh" , ( ) => {
953+ it . effect ( "recovers a discarded branch lookup on the next turn-end refresh" , ( ) => {
948954 const state : Parameters < typeof layerTestFor > [ 0 ] = {
949955 currentLocalStatus : baseLocalStatus ,
950956 currentRemoteStatus : { ...remoteStatusWithPr , aheadCount : 3 , behindCount : 5 } ,
@@ -983,9 +989,6 @@ describe("VcsStatusBroadcaster", () => {
983989 pr : { ...remoteStatusWithPr . pr ! , number : 2979 , headRef : "feature/next-status" } ,
984990 } ;
985991 state . backgroundWorkEnabled = false ;
986- yield * broadcaster . refreshPullRequestStatus ( "/repo" ) ;
987- assert . equal ( state . remoteStatusCalls , 1 ) ;
988- state . backgroundWorkEnabled = true ;
989992 const recovered = yield * broadcaster . refreshPullRequestStatus ( "/repo" ) ;
990993 assert . deepStrictEqual ( recovered , state . currentRemoteStatus ) ;
991994 const cached = yield * broadcaster . getStatus ( { cwd : "/repo" } ) ;
0 commit comments