mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 16:30:23 +00:00
test: share runtime group policy fallback cases
This commit is contained in:
@@ -1,29 +1,13 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe } from "vitest";
|
||||
import { installProviderRuntimeGroupPolicyFallbackSuite } from "../../test-utils/runtime-group-policy-contract.js";
|
||||
import { __testing } from "./access-control.js";
|
||||
|
||||
describe("resolveWhatsAppRuntimeGroupPolicy", () => {
|
||||
it("fails closed when channels.whatsapp is missing and no defaults are set", () => {
|
||||
const resolved = __testing.resolveWhatsAppRuntimeGroupPolicy({
|
||||
providerConfigPresent: false,
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("allowlist");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps open fallback when channels.whatsapp is configured", () => {
|
||||
const resolved = __testing.resolveWhatsAppRuntimeGroupPolicy({
|
||||
providerConfigPresent: true,
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("open");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(false);
|
||||
});
|
||||
|
||||
it("ignores explicit default policy when provider config is missing", () => {
|
||||
const resolved = __testing.resolveWhatsAppRuntimeGroupPolicy({
|
||||
providerConfigPresent: false,
|
||||
defaultGroupPolicy: "disabled",
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("allowlist");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(true);
|
||||
installProviderRuntimeGroupPolicyFallbackSuite({
|
||||
resolve: __testing.resolveWhatsAppRuntimeGroupPolicy,
|
||||
configuredLabel: "keeps open fallback when channels.whatsapp is configured",
|
||||
defaultGroupPolicyUnderTest: "disabled",
|
||||
missingConfigLabel: "fails closed when channels.whatsapp is missing and no defaults are set",
|
||||
missingDefaultLabel: "ignores explicit default policy when provider config is missing",
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user