mirror of https://github.com/openclaw/openclaw.git
test: dedupe msteams policy route fixtures
This commit is contained in:
parent
b23bfef8cc
commit
f2300f4522
|
|
@ -6,6 +6,27 @@ import {
|
|||
resolveMSTeamsRouteConfig,
|
||||
} from "./policy.js";
|
||||
|
||||
function resolveNamedTeamRouteConfig(allowNameMatching = false) {
|
||||
const cfg: MSTeamsConfig = {
|
||||
teams: {
|
||||
"My Team": {
|
||||
requireMention: true,
|
||||
channels: {
|
||||
"General Chat": { requireMention: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return resolveMSTeamsRouteConfig({
|
||||
cfg,
|
||||
teamName: "My Team",
|
||||
channelName: "General Chat",
|
||||
conversationId: "ignored",
|
||||
allowNameMatching,
|
||||
});
|
||||
}
|
||||
|
||||
describe("msteams policy", () => {
|
||||
describe("resolveMSTeamsRouteConfig", () => {
|
||||
it("returns team and channel config when present", () => {
|
||||
|
|
@ -51,23 +72,7 @@ describe("msteams policy", () => {
|
|||
});
|
||||
|
||||
it("blocks team and channel name matches by default", () => {
|
||||
const cfg: MSTeamsConfig = {
|
||||
teams: {
|
||||
"My Team": {
|
||||
requireMention: true,
|
||||
channels: {
|
||||
"General Chat": { requireMention: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const res = resolveMSTeamsRouteConfig({
|
||||
cfg,
|
||||
teamName: "My Team",
|
||||
channelName: "General Chat",
|
||||
conversationId: "ignored",
|
||||
});
|
||||
const res = resolveNamedTeamRouteConfig();
|
||||
|
||||
expect(res.teamConfig).toBeUndefined();
|
||||
expect(res.channelConfig).toBeUndefined();
|
||||
|
|
@ -75,24 +80,7 @@ describe("msteams policy", () => {
|
|||
});
|
||||
|
||||
it("matches team and channel by name when dangerous name matching is enabled", () => {
|
||||
const cfg: MSTeamsConfig = {
|
||||
teams: {
|
||||
"My Team": {
|
||||
requireMention: true,
|
||||
channels: {
|
||||
"General Chat": { requireMention: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const res = resolveMSTeamsRouteConfig({
|
||||
cfg,
|
||||
teamName: "My Team",
|
||||
channelName: "General Chat",
|
||||
conversationId: "ignored",
|
||||
allowNameMatching: true,
|
||||
});
|
||||
const res = resolveNamedTeamRouteConfig(true);
|
||||
|
||||
expect(res.teamConfig?.requireMention).toBe(true);
|
||||
expect(res.channelConfig?.requireMention).toBe(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue