33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { hwlabG14MonitorStateFileName } from "./src/hwlab-g14";
|
|
|
|
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
|
|
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
|
|
}
|
|
|
|
assertCondition(
|
|
hwlabG14MonitorStateFileName({ once: false, dryRun: false }) === "latest-monitor-job.json",
|
|
"long-running monitor should own latest-monitor-job.json",
|
|
);
|
|
assertCondition(
|
|
hwlabG14MonitorStateFileName({ once: true, dryRun: false }) === "latest-once-job.json",
|
|
"once jobs must not overwrite the long-running monitor pointer",
|
|
);
|
|
assertCondition(
|
|
hwlabG14MonitorStateFileName({ once: false, dryRun: true }) === "latest-dry-run-job.json",
|
|
"dry-run monitor jobs must not overwrite the live monitor pointer",
|
|
);
|
|
assertCondition(
|
|
hwlabG14MonitorStateFileName({ once: true, dryRun: true }) === "latest-once-dry-run-job.json",
|
|
"once dry-runs need a distinct pointer for low-noise diagnostics",
|
|
);
|
|
|
|
console.log(JSON.stringify({
|
|
ok: true,
|
|
checks: [
|
|
"long-running monitor owns latest-monitor-job.json",
|
|
"once jobs do not overwrite long-running monitor state",
|
|
"dry-run jobs do not overwrite live monitor state",
|
|
"once dry-run jobs have a distinct diagnostic state file",
|
|
],
|
|
}, null, 2));
|