import { expect, test } from "bun:test";
import { analyzeRuntimeImports, runtimeCapabilities } from "../src/index.ts";

test("edge and workers reject Node capabilities with stable diagnostics", () => {
  const source = `import fs from "node:fs";\nimport { connect } from "node:net";`;
  expect(analyzeRuntimeImports(source, "edge").map((item) => item.capability)).toEqual([
    "filesystem",
    "tcp",
  ]);
  expect(analyzeRuntimeImports(source, "bun")).toEqual([]);
  expect(runtimeCapabilities("service-worker").has("filesystem")).toBe(false);
});
