| ... | ... | @@ -44,6 +44,26 @@ const stubThread = { |
| 44 | 44 | } as const; |
| 45 | 45 | |
| 46 | 46 | describe("applyShellStreamEvent", () => { |
| 47 | it("ignores stale project upserts without mutating the snapshot", () => { |
| 48 | const snapshotWithProject: OrchestrationShellSnapshot = { |
| 49 | ...baseSnapshot, |
| 50 | snapshotSequence: 4, |
| 51 | projects: [stubProject], |
| 52 | }; |
| 53 | |
| 54 | for (const sequence of [3, 4]) { |
| 55 | const next = applyShellStreamEvent(snapshotWithProject, { |
| 56 | kind: "project-upserted", |
| 57 | sequence, |
| 58 | project: { ...stubProject, title: "Stale Title" }, |
| 59 | }); |
| 60 | |
| 61 | expect(next).toBe(snapshotWithProject); |
| 62 | expect(next.snapshotSequence).toBe(4); |
| 63 | expect(next.projects[0]?.title).toBe("Test Project"); |
| 64 | } |
| 65 | }); |
| 66 | |
| 47 | 67 | describe("project-upserted", () => { |
| 48 | 68 | it("adds a new project", () => { |
| 49 | 69 | const event: OrchestrationShellStreamEvent = { |