import { describe, expect, it } from "vitest"; import { shouldApplyTerminalEvent } from "./service"; describe("shouldApplyTerminalEvent", () => { it("applies terminal events for draft-only threads", () => { expect( shouldApplyTerminalEvent({ serverThreadArchivedAt: undefined, hasDraftThread: true, }), ).toBe(true); }); it("drops terminal events for unknown threads", () => { expect( shouldApplyTerminalEvent({ serverThreadArchivedAt: undefined, hasDraftThread: false, }), ).toBe(false); }); it("drops terminal events for archived server threads even if a draft exists", () => { expect( shouldApplyTerminalEvent({ serverThreadArchivedAt: "2026-04-09T00:00:00.000Z", hasDraftThread: true, }), ).toBe(false); }); it("applies terminal events for active server threads", () => { expect( shouldApplyTerminalEvent({ serverThreadArchivedAt: null, hasDraftThread: false, }), ).toBe(true); });});
import { describe, expect, it } from "vitest";
import { shouldApplyTerminalEvent } from "./service";
describe("shouldApplyTerminalEvent", () => {
it("applies terminal events for draft-only threads", () => {
expect(
shouldApplyTerminalEvent({
serverThreadArchivedAt: undefined,
hasDraftThread: true,
}),
).toBe(true);
});
it("drops terminal events for unknown threads", () => {
expect(
shouldApplyTerminalEvent({
serverThreadArchivedAt: undefined,
hasDraftThread: false,
}),
).toBe(false);
});
it("drops terminal events for archived server threads even if a draft exists", () => {
expect(
shouldApplyTerminalEvent({
serverThreadArchivedAt: "2026-04-09T00:00:00.000Z",
hasDraftThread: true,
}),
).toBe(false);
});
it("applies terminal events for active server threads", () => {
expect(
shouldApplyTerminalEvent({
serverThreadArchivedAt: null,
hasDraftThread: false,
}),
).toBe(true);
});
});