| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { buildNativeReviewTokensResetKey } from "./reviewDiffBridgeKeys"; |
| 4 | |
| 5 | describe("native review diff bridge", () => { |
| 6 | it("changes reset keys when the rendered diff identity changes", () => { |
| 7 | const input = { |
| 8 | threadKey: "env:thread", |
| 9 | sectionId: "turn:2", |
| 10 | scheme: "dark" as const, |
| 11 | diff: "diff --git a/a.ts b/a.ts", |
| 12 | fileCount: 1, |
| 13 | rowCount: 4, |
| 14 | }; |
| 15 | |
| 16 | const resetKey = buildNativeReviewTokensResetKey(input); |
| 17 | |
| 18 | expect( |
| 19 | buildNativeReviewTokensResetKey({ ...input, diff: "diff --git a/b.ts b/b.ts" }), |
| 20 | ).not.toBe(resetKey); |
| 21 | expect(buildNativeReviewTokensResetKey({ ...input, rowCount: 5 })).not.toBe(resetKey); |
| 22 | expect(buildNativeReviewTokensResetKey({ ...input, diff: null })).not.toBe(resetKey); |
| 23 | }); |
| 24 | }); |