Skip to content

Commit 7b5f957

Browse files
committed
test: isolate sweep status coverage
1 parent 00e80a1 commit 7b5f957

2 files changed

Lines changed: 40 additions & 36 deletions

File tree

‎test/clawsweeper.test.ts‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import {
3838
shardItemNumbers,
3939
shouldSyncReviewComment,
4040
shouldRetryGh,
41-
sweepStatusApplyHealthForTest,
4241
timeoutWithinRuntimeBudget,
4342
} from "../dist/clawsweeper.js";
4443
import { parseArgs as parseClawsweeperArgs } from "../dist/clawsweeper-args.js";
@@ -82,27 +81,6 @@ const maintainerDecision = {
8281
},
8382
};
8483

85-
test("sweep status preserves a retained apply-health run URL", () => {
86-
const retained = {
87-
mode: "close",
88-
run_url: "https://github.com/openclaw/clawsweeper/actions/runs/29091427650",
89-
};
90-
assert.deepEqual(
91-
sweepStatusApplyHealthForTest({
92-
previousApplyHealth: retained,
93-
runUrl: "https://github.com/openclaw/clawsweeper/actions/runs/29091585991",
94-
}),
95-
retained,
96-
);
97-
assert.deepEqual(
98-
sweepStatusApplyHealthForTest({
99-
requestedApplyHealth: { mode: "close" },
100-
runUrl: "https://github.com/openclaw/clawsweeper/actions/runs/29091427650",
101-
}),
102-
retained,
103-
);
104-
});
105-
10684
test("review comments include a compact maintainer decision packet block", () => {
10785
const comment = renderReviewCommentFromReport(
10886
workPlanCandidateReport({
@@ -2679,20 +2657,6 @@ test("sweep dashboard status writes are scoped to the target repository", () =>
26792657
}
26802658
});
26812659

2682-
test("sweep status writer preserves non-apply health and clears stale apply updates", () => {
2683-
const source = readText("src/clawsweeper.ts");
2684-
2685-
assert.match(
2686-
source,
2687-
/applyHealthArg === undefined && state\.startsWith\("Apply "\) \? null : applyHealthArg/,
2688-
);
2689-
assert.match(source, /requestedApplyHealth: options\.applyHealth/);
2690-
assert.match(source, /apply_health: applyHealth \?\? null/);
2691-
assert.match(source, /last_close_apply_health: lastCloseApplyHealth \?\? null/);
2692-
assert.match(source, /previousStatus\?\.lastCloseApplyHealth/);
2693-
assert.match(source, /previousStatus\?\.applyHealth\?\.mode === "close"/);
2694-
});
2695-
26962660
test("review parser strips environment access caveats from risks", () => {
26972661
const parsed = parseDecision(
26982662
closeDecision({

‎test/sweep-status.test.ts‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import assert from "node:assert/strict";
2+
import test from "node:test";
3+
4+
import { sweepStatusApplyHealthForTest } from "../dist/clawsweeper.js";
5+
import { readText } from "./helpers.ts";
6+
7+
test("sweep status preserves a retained apply-health run URL", () => {
8+
const retained = {
9+
mode: "close",
10+
run_url: "https://github.com/openclaw/clawsweeper/actions/runs/29091427650",
11+
};
12+
assert.deepEqual(
13+
sweepStatusApplyHealthForTest({
14+
previousApplyHealth: retained,
15+
runUrl: "https://github.com/openclaw/clawsweeper/actions/runs/29091585991",
16+
}),
17+
retained,
18+
);
19+
assert.deepEqual(
20+
sweepStatusApplyHealthForTest({
21+
requestedApplyHealth: { mode: "close" },
22+
runUrl: "https://github.com/openclaw/clawsweeper/actions/runs/29091427650",
23+
}),
24+
retained,
25+
);
26+
});
27+
28+
test("sweep status writer preserves non-apply health and clears stale apply updates", () => {
29+
const source = readText("src/clawsweeper.ts");
30+
31+
assert.match(
32+
source,
33+
/applyHealthArg === undefined && state\.startsWith\("Apply "\) \? null : applyHealthArg/,
34+
);
35+
assert.match(source, /requestedApplyHealth: options\.applyHealth/);
36+
assert.match(source, /apply_health: applyHealth \?\? null/);
37+
assert.match(source, /last_close_apply_health: lastCloseApplyHealth \?\? null/);
38+
assert.match(source, /previousStatus\?\.lastCloseApplyHealth/);
39+
assert.match(source, /previousStatus\?\.applyHealth\?\.mode === "close"/);
40+
});

0 commit comments

Comments
 (0)