The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { clearSubmittedReview, type ReviewDraft } from "./pullRequestReviewDrafts"; |
| 3 | const comment = { |
| 4 | id: "one", |
| 5 | path: "renamed.ts", |
| 6 | oldPath: "old.ts", |
| 7 | position: { kind: "deleted" as const, oldLine: 9 }, |
| 8 | body: "Keep this", |
| 9 | headSha: "abc", |
| 10 | code: "old line", |
| 11 | }; |
| 12 | const draft: ReviewDraft = { |
| 13 | summary: "Review", |
| 14 | comment: "Separate PR comment", |
| 15 | comments: [comment], |
| 16 | }; |
| 17 | describe("mobile review draft recovery", () => { |
| 18 | it("clears a submitted snapshot while retaining edits made during the request", () => { |
| 19 | const current = { |
| 20 | ...draft, |
| 21 | summary: "New summary", |
| 22 | comments: [ |
| 23 | { ...comment, body: "New feedback" }, |
| 24 | { ...comment, id: "two" }, |
| 25 | ], |
| 26 | }; |
| 27 | expect(clearSubmittedReview(current, draft)).toEqual(current); |
| 28 | expect(clearSubmittedReview(draft, draft)).toEqual({ |
| 29 | summary: "", |
| 30 | comment: draft.comment, |
| 31 | comments: [], |
| 32 | }); |
| 33 | }); |
| 34 | }); |