|
9 | 9 | resolveDraftEnvModeAfterBranchChange, |
10 | 10 | resolveEffectiveEnvMode, |
11 | 11 | resolveEnvModeLabel, |
| 12 | + resolveBranchToolbarPrBranch, |
12 | 13 | resolveBranchToolbarValue, |
13 | 14 | resolveLockedWorkspaceLabel, |
14 | 15 | resolveLocalCheckoutBranchMismatch, |
@@ -173,6 +174,35 @@ describe("resolveBranchToolbarValue", () => { |
173 | 174 | }); |
174 | 175 | }); |
175 | 176 |
|
| 177 | +describe("resolveBranchToolbarPrBranch", () => { |
| 178 | + it("uses the explicit thread branch when it matches the displayed branch", () => { |
| 179 | + expect( |
| 180 | + resolveBranchToolbarPrBranch({ |
| 181 | + activeThreadBranch: "feature/current", |
| 182 | + resolvedActiveBranch: "feature/current", |
| 183 | + }), |
| 184 | + ).toBe("feature/current"); |
| 185 | + }); |
| 186 | + |
| 187 | + it("hides PR state while an optimistic branch switch is in flight", () => { |
| 188 | + expect( |
| 189 | + resolveBranchToolbarPrBranch({ |
| 190 | + activeThreadBranch: "feature/current", |
| 191 | + resolvedActiveBranch: "feature/next", |
| 192 | + }), |
| 193 | + ).toBeNull(); |
| 194 | + }); |
| 195 | + |
| 196 | + it("does not infer PR state without an explicit thread branch", () => { |
| 197 | + expect( |
| 198 | + resolveBranchToolbarPrBranch({ |
| 199 | + activeThreadBranch: null, |
| 200 | + resolvedActiveBranch: "feature/current", |
| 201 | + }), |
| 202 | + ).toBeNull(); |
| 203 | + }); |
| 204 | +}); |
| 205 | + |
176 | 206 | describe("resolveLocalCheckoutBranchMismatch", () => { |
177 | 207 | it("detects when a local thread is associated with a different branch than the checkout", () => { |
178 | 208 | expect( |
|
0 commit comments