mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 21:10:25 +00:00
fix: include shared runtime group-policy helper and coverage (#23367) (thanks @bmendonca3)
This commit is contained in:
29
src/web/inbound/access-control.group-policy.test.ts
Normal file
29
src/web/inbound/access-control.group-policy.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user