Initial Commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
interface PackageManifest {
|
||||
readonly name: string;
|
||||
readonly version: string;
|
||||
readonly dependencies: Record<string, string>;
|
||||
readonly devDependencies: Record<string, string>;
|
||||
}
|
||||
|
||||
const manifestPath = fileURLToPath(new URL("../package.json", import.meta.url));
|
||||
const manifest = JSON.parse(
|
||||
readFileSync(manifestPath, "utf8")
|
||||
) as PackageManifest;
|
||||
|
||||
describe("dep-graph", () => {
|
||||
it("package name and version are stable", { timeout: 5000 }, () => {
|
||||
expect(manifest.name).toBe("@suaveplan/api-openapi-ui-scalar");
|
||||
expect(manifest.version).toBe("0.1.0");
|
||||
});
|
||||
|
||||
it("runtime deps cover error, zod, otel api, tslib", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
const deps = manifest.dependencies;
|
||||
expect(deps["@suaveplan/error"]).toBe("workspace:^");
|
||||
expect(deps["@opentelemetry/api"]).toBeDefined();
|
||||
expect(deps.zod).toBeDefined();
|
||||
expect(deps.tslib).toBeDefined();
|
||||
});
|
||||
|
||||
it("does NOT pull in router (handler is router-agnostic)", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
expect(manifest.dependencies["@suaveplan/api-router"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does NOT pull in api-openapi at runtime (consumed by the host, not us)", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
expect(manifest.dependencies["@suaveplan/api-openapi"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("testing kit is a devDependency only", { timeout: 5000 }, () => {
|
||||
expect(manifest.devDependencies["@suaveplan/testing"]).toBe(
|
||||
"workspace:^"
|
||||
);
|
||||
expect(manifest.dependencies["@suaveplan/testing"]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user