Showing the changes to apps/web/src/diffPanelStore.test.ts (1 of 4 files). Show all
Unified · Split
| @@ -9,12 +9,26 @@ const THREAD_REF = scopeThreadRef(EnvironmentId.make("environment-1"), ThreadId. · 8 unmodified lines | ||
| 9 | 9 | describe("diffPanelStore", () => { |
| 10 | 10 | beforeEach(() => useDiffPanelStore.setState({ byThreadKey: {}, branchBaseRefByThreadKey: {} })); |
| 11 | 11 | |
| 12 | − it("defaults each thread to branch changes with automatic base selection", () => { | |
| 12 | + it("defaults each thread to branch changes when the working tree is clean", () => { | |
| 13 | 13 | expect( |
| 14 | 14 | selectThreadDiffPanelSelection(useDiffPanelStore.getState().byThreadKey, THREAD_REF), |
| 15 | 15 | ).toEqual({ kind: "branch", baseRef: null }); |
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | + it("defaults each thread to working changes when the working tree is dirty", () => { | |
| 19 | + expect( | |
| 20 | + selectThreadDiffPanelSelection(useDiffPanelStore.getState().byThreadKey, THREAD_REF, true), | |
| 21 | + ).toEqual({ kind: "unstaged" }); | |
| 22 | + }); | |
| 23 | + | |
| 24 | + it("preserves an explicit scope selection when the working tree state changes", () => { | |
| 25 | + useDiffPanelStore.getState().selectGitScope(THREAD_REF, "branch"); | |
| 26 | + | |
| 27 | + expect( | |
| 28 | + selectThreadDiffPanelSelection(useDiffPanelStore.getState().byThreadKey, THREAD_REF, true), | |
| 29 | + ).toEqual({ kind: "branch", baseRef: null }); | |
| 30 | + }); | |
| 31 | + | |
| 18 | 32 | it("clears incompatible selection fields when changing scopes", () => { |
| 19 | 33 | const store = useDiffPanelStore.getState(); |
| 20 | 34 | store.selectTurn(THREAD_REF, TurnId.make("turn-1"), "src/app.ts"); |