import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
const currentDir = dirname(fileURLToPath(import.meta.url));
const srcDir = resolve(currentDir, "..");
describe("system metrics route wiring", () => {
    it("mounts the authenticated machine metrics route under /runtime", () => {
        const routeSource = readFileSync(resolve(currentDir, "./system-metrics.ts"), "utf-8");
        const indexSource = readFileSync(resolve(srcDir, "./index.ts"), "utf-8");
        expect(routeSource).toContain('systemMetricsRouter.get("/system-metrics", validateToken');
        expect(routeSource).toContain("collectSystemMetrics");
        expect(indexSource).toContain('import { systemMetricsRouter } from "./routes/system-metrics.js";');
        expect(indexSource).toContain('app.use("/runtime", systemMetricsRouter);');
    });
});
