Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { hiveGridBillingCatalogVersion } from "@hivegrid/entitlements";
|
||||
|
||||
import { parseBillingCatalogCommand } from "./contracts";
|
||||
|
||||
const baseEnv = {
|
||||
NODE_ENV: "production",
|
||||
LAGO_API_URL: "http://127.0.0.1:3108",
|
||||
LAGO_API_KEY: "lago_secret",
|
||||
};
|
||||
|
||||
describe("billing catalog operator contracts", () => {
|
||||
it("parses read-only staging plan mode with the canonical identity", () => {
|
||||
expect(parseBillingCatalogCommand(["--target=staging", "--plan"], baseEnv)).toMatchObject({
|
||||
target: "staging",
|
||||
mode: "plan",
|
||||
expectedOrganizationName: "HiveGrid Staging",
|
||||
});
|
||||
});
|
||||
|
||||
it("requires exact versioned confirmation for apply", () => {
|
||||
expect(() => parseBillingCatalogCommand(["--target=staging", "--apply"], baseEnv)).toThrow(`--confirm=staging:${hiveGridBillingCatalogVersion}`);
|
||||
expect(parseBillingCatalogCommand(["--target=staging", "--apply", `--confirm=staging:${hiveGridBillingCatalogVersion}`], baseEnv).mode).toBe("apply");
|
||||
});
|
||||
|
||||
it("uses the pinned production organization identity", () => {
|
||||
expect(parseBillingCatalogCommand(["--target=production", "--verify"], baseEnv)).toMatchObject({
|
||||
target: "production",
|
||||
expectedOrganizationName: "HiveGrid",
|
||||
expectedOrganizationIdSha256: "c54f682e7528f2f1d556a5f539d6d200aa7d9163c9aec31f8fb5b21be632505e",
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects unsafe runtime mode and credential-bearing URLs", () => {
|
||||
expect(() => parseBillingCatalogCommand(["--target=staging"], { ...baseEnv, NODE_ENV: "development" })).toThrow("NODE_ENV must be production");
|
||||
expect(() =>
|
||||
parseBillingCatalogCommand(["--target=staging"], {
|
||||
...baseEnv,
|
||||
LAGO_API_URL: "https://user:password@lago.example.test/api/v1",
|
||||
})
|
||||
).toThrow("HTTP(S) origin");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user