Keep finished terminals visible as attention
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { TERMINAL_ACTIVITY_STATES, TerminalActivitySchema } from "./terminal-activity.js";
|
||||
import {
|
||||
TERMINAL_ACTIVITY_ATTENTION_REASONS,
|
||||
TERMINAL_ACTIVITY_STATES,
|
||||
TerminalActivitySchema,
|
||||
deriveTerminalActivityStatusBucket,
|
||||
} from "./terminal-activity.js";
|
||||
|
||||
describe("TerminalActivitySchema", () => {
|
||||
it("parses the known activity states", () => {
|
||||
@@ -16,4 +21,32 @@ describe("TerminalActivitySchema", () => {
|
||||
expect(parsed.state).toBe("idle");
|
||||
expect(parsed.changedAt).toBe(1718000000000);
|
||||
});
|
||||
|
||||
it("parses known attention reasons", () => {
|
||||
for (const attentionReason of TERMINAL_ACTIVITY_ATTENTION_REASONS) {
|
||||
expect(
|
||||
TerminalActivitySchema.parse({ state: "attention", attentionReason, changedAt: 1 })
|
||||
.attentionReason,
|
||||
).toBe(attentionReason);
|
||||
}
|
||||
});
|
||||
|
||||
it("maps terminal activity to workspace status buckets", () => {
|
||||
expect(deriveTerminalActivityStatusBucket({ state: "working", changedAt: 1 })).toBe("running");
|
||||
expect(
|
||||
deriveTerminalActivityStatusBucket({
|
||||
state: "idle",
|
||||
attentionReason: "finished",
|
||||
changedAt: 1,
|
||||
}),
|
||||
).toBe("attention");
|
||||
expect(
|
||||
deriveTerminalActivityStatusBucket({
|
||||
state: "idle",
|
||||
attentionReason: "needs_input",
|
||||
changedAt: 1,
|
||||
}),
|
||||
).toBe("needs_input");
|
||||
expect(deriveTerminalActivityStatusBucket({ state: "idle", changedAt: 1 })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user