| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { buildThreadTitleRegenerationMenuItems } from "./thread-title-regeneration-menu"; |
| 4 | |
| 5 | describe("buildThreadTitleRegenerationMenuItems", () => { |
| 6 | it("hides regeneration when the environment does not advertise support", () => { |
| 7 | expect( |
| 8 | buildThreadTitleRegenerationMenuItems({ supported: false, isRegenerating: false }), |
| 9 | ).toEqual([]); |
| 10 | }); |
| 11 | |
| 12 | it("offers regeneration for a supported environment", () => { |
| 13 | expect( |
| 14 | buildThreadTitleRegenerationMenuItems({ supported: true, isRegenerating: false }), |
| 15 | ).toEqual([ |
| 16 | { |
| 17 | id: "regenerate-title", |
| 18 | title: "Regenerate title", |
| 19 | image: "arrow.clockwise", |
| 20 | }, |
| 21 | ]); |
| 22 | }); |
| 23 | |
| 24 | it("shows and disables the pending state", () => { |
| 25 | expect( |
| 26 | buildThreadTitleRegenerationMenuItems({ supported: true, isRegenerating: true }), |
| 27 | ).toEqual([ |
| 28 | { |
| 29 | id: "regenerate-title", |
| 30 | title: "Regenerating…", |
| 31 | image: "arrow.clockwise", |
| 32 | attributes: { disabled: true }, |
| 33 | }, |
| 34 | ]); |
| 35 | }); |
| 36 | }); |