| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { resolveRenameCommit } from "./ChatHeader"; |
| 3 | |
| 4 | describe("resolveRenameCommit", () => { |
| 5 | it("commits a trimmed changed title", () => { |
| 6 | expect(resolveRenameCommit({ title: " New title ", originalTitle: "Old" })).toEqual({ |
| 7 | action: "commit", |
| 8 | title: "New title", |
| 9 | }); |
| 10 | }); |
| 11 | |
| 12 | it("rejects empty and whitespace-only titles", () => { |
| 13 | expect(resolveRenameCommit({ title: " ", originalTitle: "Old" })).toEqual({ |
| 14 | action: "reject-empty", |
| 15 | }); |
| 16 | }); |
| 17 | |
| 18 | it("no-ops when the trimmed title is unchanged", () => { |
| 19 | expect(resolveRenameCommit({ title: " Old ", originalTitle: "Old" })).toEqual({ |
| 20 | action: "noop", |
| 21 | }); |
| 22 | }); |
| 23 | }); |