runtime-platform-headers.test.ts 664 B

12345678910111213141516
  1. import { arch as readOsArch, release as readOsRelease } from "node:os";
  2. import { describe, expect, it } from "vitest";
  3. import { createRuntimePlatformHeaders } from "../src/runtime-platform-headers.js";
  4. describe("createRuntimePlatformHeaders", () => {
  5. it("builds runtime platform headers from the current agent runtime host", () => {
  6. const osCategory =
  7. process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : "linux";
  8. expect(createRuntimePlatformHeaders()).toEqual({
  9. "X-Os-Category": osCategory,
  10. "X-Os-Version": readOsRelease(),
  11. "X-Platform": `${process.platform}-${readOsArch()}`,
  12. });
  13. });
  14. });