Initial Commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const pkgJson = JSON.parse(
|
||||
readFileSync(resolve(here, "..", "package.json"), "utf8")
|
||||
) as {
|
||||
dependencies: Record<string, string>;
|
||||
devDependencies: Record<string, string>;
|
||||
};
|
||||
|
||||
describe("api-tenant-provider dependency graph", () => {
|
||||
it("declares the expected runtime deps", { timeout: 5000 }, () => {
|
||||
const deps = Object.keys(pkgJson.dependencies).sort();
|
||||
expect(deps).toEqual([
|
||||
"@suaveplan/api-types",
|
||||
"@suaveplan/error",
|
||||
"@suaveplan/types",
|
||||
"tslib",
|
||||
"zod",
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses workspace:^ for every @suaveplan/* runtime dep", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
for (const [name, range] of Object.entries(pkgJson.dependencies)) {
|
||||
if (name.startsWith("@suaveplan/")) {
|
||||
expect(range).toBe("workspace:^");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("does NOT depend on @suaveplan/api-host or @suaveplan/api-router", {
|
||||
timeout: 5000,
|
||||
}, () => {
|
||||
// Stage-1 contract package — must not see the host or router.
|
||||
expect(pkgJson.dependencies["@suaveplan/api-host"]).toBeUndefined();
|
||||
expect(pkgJson.dependencies["@suaveplan/api-router"]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user