Files
api/scripts/staging-edge-gateway-smoke.test.mjs
T
Jeppe Bundgaard 7d450e285e Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
2026-04-21 14:13:17 +02:00

38 lines
1.2 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import {
DEFAULT_STAGING_BASE_URL,
buildChecks,
normalizeBaseUrl,
parseArgs,
} from "./staging-edge-gateway-smoke.mjs";
test("normalizeBaseUrl strips trailing slashes", () => {
assert.equal(normalizeBaseUrl("https://api.truckwash.io:4433///"), DEFAULT_STAGING_BASE_URL);
});
test("parseArgs accepts base URL and install token", () => {
const options = parseArgs([
"--base-url",
"https://staging.example.test/",
"--install-token",
"token-123",
]);
assert.equal(options.baseUrl, "https://staging.example.test/");
assert.equal(options.installToken, "token-123");
assert.equal(options.help, false);
});
test("buildChecks targets the public staging endpoints", () => {
const checks = buildChecks(DEFAULT_STAGING_BASE_URL, "abc 123");
assert.deepEqual(checks.map((check) => check.url), [
"https://api.truckwash.io:4433/ping",
"https://api.truckwash.io:4433/edge-agent/artifacts/agent.php",
"https://api.truckwash.io:4433/edge-agent/artifacts/truckwash-edge-agent.service",
"https://api.truckwash.io:4433/edge-agent/install.sh?token=abc%20123",
]);
});