mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 11:30:41 +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 { resolveTelegramRuntimeGroupPolicy } from "./group-access.js";
|
||||
|
||||
describe("resolveTelegramRuntimeGroupPolicy", () => {
|
||||
it("fails closed when channels.telegram is missing and no defaults are set", () => {
|
||||
const resolved = resolveTelegramRuntimeGroupPolicy({
|
||||
providerConfigPresent: false,
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("allowlist");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps open fallback when channels.telegram is configured", () => {
|
||||
const resolved = resolveTelegramRuntimeGroupPolicy({
|
||||
providerConfigPresent: true,
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("open");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(false);
|
||||
});
|
||||
|
||||
it("ignores explicit defaults when provider config is missing", () => {
|
||||
const resolved = resolveTelegramRuntimeGroupPolicy({
|
||||
providerConfigPresent: false,
|
||||
defaultGroupPolicy: "disabled",
|
||||
});
|
||||
expect(resolved.groupPolicy).toBe("allowlist");
|
||||
expect(resolved.providerMissingFallbackApplied).toBe(true);
|
||||
installProviderRuntimeGroupPolicyFallbackSuite({
|
||||
resolve: resolveTelegramRuntimeGroupPolicy,
|
||||
configuredLabel: "keeps open fallback when channels.telegram is configured",
|
||||
defaultGroupPolicyUnderTest: "disabled",
|
||||
missingConfigLabel: "fails closed when channels.telegram is missing and no defaults are set",
|
||||
missingDefaultLabel: "ignores explicit defaults when provider config is missing",
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user