Files
openclaw/test/e2e/qa-lab/runtime/heartbeat-active-hours-runtime.test.ts
Peter Steinberger ca3a1873a6 fix(test): make broad shard execution deterministic (#111416)
* fix(test): harden broad shard execution

* test: allow broad-profile contention

* style(telegram): remove redundant chat id cast

* style(test): preserve setup test spacing
2026-07-19 08:39:16 -07:00

34 lines
1.2 KiB
TypeScript

import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { runHeartbeatActiveHoursRuntime } from "./heartbeat-active-hours-runtime.js";
const tempDirs: string[] = [];
afterEach(async () => {
await Promise.all(tempDirs.splice(0).map((dir) => fs.rm(dir, { force: true, recursive: true })));
});
describe("heartbeat active-hours runtime evidence", () => {
it("observes active fire, quiet-hours skip, and reload fire", async () => {
const artifactBase = await fs.mkdtemp(path.join(os.tmpdir(), "heartbeat-active-hours-"));
tempDirs.push(artifactBase);
const evidence = await runHeartbeatActiveHoursRuntime({
artifactBase,
repoRoot: process.cwd(),
timeoutMs: 5_000,
});
expect(evidence.entries[0]?.result.status).toBe("pass");
const summary = JSON.parse(
await fs.readFile(path.join(artifactBase, "heartbeat-active-hours-summary.json"), "utf8"),
) as { observations: Array<{ outcome: string }> };
expect(summary.observations.map((entry) => entry.outcome)).toEqual([
"active-fire",
"quiet-hours-skip",
"active-fire",
]);
});
});