Open History to see the last commit
1import * as DateTime from "effect/DateTime";
2import { describe, expect, it } from "vite-plus/test";
3
4import { subagentResumedSince } from "./V2LifecycleRow.logic";
5
6const failedAt = "2026-10-09T12:21:00.000Z";
7const beforeFailure = DateTime.makeUnsafe("2026-10-09T12:05:00.000Z");
8const afterFailure = DateTime.makeUnsafe("2026-10-09T12:48:00.000Z");
9
10describe("subagentResumedSince", () => {
11 it("is true while a resumed subagent runs", () => {
12 expect(subagentResumedSince({ status: "running", startedAt: afterFailure }, failedAt)).toBe(
13 true,
14 );
15 });
16
17 it("is true while it runs even when the notification was delivered after the resume", () => {
18 expect(
19 subagentResumedSince(
20 { status: "running", startedAt: afterFailure },
21 "2026-10-09T12:50:00.000Z",
22 ),
23 ).toBe(true);
24 });
25
26 it("is true once a run started after the notification has settled", () => {
27 expect(subagentResumedSince({ status: "completed", startedAt: afterFailure }, failedAt)).toBe(
28 true,
29 );
30 });
31
32 it("is false for the run the notification reported on", () => {
33 expect(subagentResumedSince({ status: "failed", startedAt: beforeFailure }, failedAt)).toBe(
34 false,
35 );
36 });
37
38 it("is false for a settled subagent with no start time", () => {
39 expect(subagentResumedSince({ status: "failed", startedAt: null }, failedAt)).toBe(false);
40 });
41});