@@ -382,13 +382,14 @@ describe("VcsStatusBroadcaster", () => { |
382 | 382 | ); |
383 | 383 |
|
384 | 384 | it.effect("refreshes a loaded cwd without reusing a previous branch's PR", () => { |
385 | | - const state = { |
| 385 | + const state: Parameters<typeof layerTestFor>[0] = { |
386 | 386 | currentLocalStatus: baseLocalStatus, |
387 | | - currentRemoteStatus: baseRemoteStatus, |
| 387 | + currentRemoteStatus: { ...baseRemoteStatus, aheadCount: 3, behindCount: 5 }, |
388 | 388 | localStatusCalls: 0, |
389 | 389 | remoteStatusCalls: 0, |
390 | 390 | localInvalidationCalls: 0, |
391 | 391 | remoteInvalidationCalls: 0, |
| 392 | + remoteStatusRefreshUpstreamValues: [], |
392 | 393 | }; |
393 | 394 |
|
394 | 395 | return Effect.gen(function* () { |
@@ -400,9 +401,14 @@ describe("VcsStatusBroadcaster", () => { |
400 | 401 | yield* broadcaster.getStatus({ cwd: "/repo" }); |
401 | 402 | assert.equal(state.remoteStatusCalls, 1); |
402 | 403 |
|
403 | | - state.currentRemoteStatus = remoteStatusWithPr; |
| 404 | + state.backgroundWorkEnabled = false; |
| 405 | + state.currentRemoteStatus = { ...remoteStatusWithPr, aheadCount: 7 }; |
404 | 406 | 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); |
406 | 412 | assert.equal(state.remoteStatusCalls, 2); |
407 | 413 | assert.equal(state.remoteInvalidationCalls, 2); |
408 | 414 |
|
@@ -944,7 +950,7 @@ describe("VcsStatusBroadcaster", () => { |
944 | 950 | }, |
945 | 951 | ); |
946 | 952 |
|
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", () => { |
948 | 954 | const state: Parameters<typeof layerTestFor>[0] = { |
949 | 955 | currentLocalStatus: baseLocalStatus, |
950 | 956 | currentRemoteStatus: { ...remoteStatusWithPr, aheadCount: 3, behindCount: 5 }, |
@@ -983,9 +989,6 @@ describe("VcsStatusBroadcaster", () => { |
983 | 989 | pr: { ...remoteStatusWithPr.pr!, number: 2979, headRef: "feature/next-status" }, |
984 | 990 | }; |
985 | 991 | state.backgroundWorkEnabled = false; |
986 | | - yield* broadcaster.refreshPullRequestStatus("/repo"); |
987 | | - assert.equal(state.remoteStatusCalls, 1); |
988 | | - state.backgroundWorkEnabled = true; |
989 | 992 | const recovered = yield* broadcaster.refreshPullRequestStatus("/repo"); |
990 | 993 | assert.deepStrictEqual(recovered, state.currentRemoteStatus); |
991 | 994 | const cached = yield* broadcaster.getStatus({ cwd: "/repo" }); |
|