| 1 | import { ProviderDriverKind, ProviderInstanceId } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { |
| 5 | resolveThreadActivityMetadata, |
| 6 | resolveThreadActivityStatus, |
| 7 | } from "./thread-activity-row-presentation"; |
| 8 | |
| 9 | describe("thread activity row presentation", () => { |
| 10 | it("shows the provider and model as compact metadata", () => { |
| 11 | expect( |
| 12 | resolveThreadActivityMetadata({ |
| 13 | providerDriver: ProviderDriverKind.make("codex"), |
| 14 | providerInstanceId: ProviderInstanceId.make("codex"), |
| 15 | model: "gpt-5.4", |
| 16 | }), |
| 17 | ).toBe("Codex · gpt-5.4"); |
| 18 | }); |
| 19 | |
| 20 | it("falls back to the provider instance and removes duplicate metadata", () => { |
| 21 | expect( |
| 22 | resolveThreadActivityMetadata({ |
| 23 | providerDriver: null, |
| 24 | providerInstanceId: ProviderInstanceId.make("custom-agent"), |
| 25 | model: "custom-agent", |
| 26 | }), |
| 27 | ).toBe("custom-agent"); |
| 28 | }); |
| 29 | |
| 30 | it("maps lifecycle status to dot tone and an accessible label", () => { |
| 31 | expect(resolveThreadActivityStatus("idle")).toEqual({ label: "Idle", tone: "neutral" }); |
| 32 | expect(resolveThreadActivityStatus("running")).toEqual({ label: "Running", tone: "active" }); |
| 33 | expect(resolveThreadActivityStatus("completed")).toEqual({ |
| 34 | label: "Completed", |
| 35 | tone: "success", |
| 36 | }); |
| 37 | expect(resolveThreadActivityStatus("failed")).toEqual({ label: "Failed", tone: "danger" }); |
| 38 | expect(resolveThreadActivityStatus("interrupted")).toEqual({ |
| 39 | label: "Interrupted", |
| 40 | tone: "warning", |
| 41 | }); |
| 42 | }); |
| 43 | }); |