30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
|
test("shipped local-agent configs use the faster heartbeat default", async () => {
|
|
const exampleConfig = JSON.parse(
|
|
await readFile(path.join(repoRoot, "local-agent", "config.example.json"), "utf8"),
|
|
);
|
|
const cloudConfig = JSON.parse(
|
|
await readFile(path.join(repoRoot, "local-agent", "config.cloud.json"), "utf8"),
|
|
);
|
|
|
|
assert.equal(exampleConfig.heartbeatIntervalMs, 15_000);
|
|
assert.equal(cloudConfig.heartbeatIntervalMs, 15_000);
|
|
});
|
|
|
|
test("device enrollment snippet advertises the faster heartbeat default", async () => {
|
|
const source = await readFile(path.join(repoRoot, "src", "components", "app-ui.tsx"), "utf8");
|
|
assert.match(source, /heartbeatIntervalMs:\s*15000/);
|
|
});
|
|
|
|
test("local-agent runtime falls back to the faster heartbeat default", async () => {
|
|
const source = await readFile(path.join(repoRoot, "local-agent", "server.mjs"), "utf8");
|
|
assert.match(source, /heartbeatIntervalMs\s*\?\?\s*15000/);
|
|
});
|