Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { resolvePluginLifecycleRuntimeEnv } from "./index.js";
|
||||
|
||||
describe("resolvePluginLifecycleRuntimeEnv", () => {
|
||||
test("defaults to development with capability consent required when env is empty", () => {
|
||||
expect(resolvePluginLifecycleRuntimeEnv()).toEqual({
|
||||
nodeEnv: "development",
|
||||
requireCapabilityConsent: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("passes NODE_ENV through without altering consent default", () => {
|
||||
expect(resolvePluginLifecycleRuntimeEnv({ NODE_ENV: "production" })).toEqual({
|
||||
nodeEnv: "production",
|
||||
requireCapabilityConsent: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("only the literal string 'false' opts out of capability consent (fail-closed)", () => {
|
||||
expect(resolvePluginLifecycleRuntimeEnv({ PLUGIN_REQUIRE_CAPABILITY_CONSENT: "false" }).requireCapabilityConsent).toBe(false);
|
||||
|
||||
// Any non-"false" value keeps consent enabled — the gate fails closed.
|
||||
for (const value of ["true", "1", "0", "no", "off", "FALSE", " false ", ""]) {
|
||||
expect(resolvePluginLifecycleRuntimeEnv({ PLUGIN_REQUIRE_CAPABILITY_CONSENT: value }).requireCapabilityConsent).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
test("resolves both fields together for a fully configured env", () => {
|
||||
expect(
|
||||
resolvePluginLifecycleRuntimeEnv({
|
||||
NODE_ENV: "test",
|
||||
PLUGIN_REQUIRE_CAPABILITY_CONSENT: "false",
|
||||
})
|
||||
).toEqual({
|
||||
nodeEnv: "test",
|
||||
requireCapabilityConsent: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user