


























@@ -1,4 +1,4 @@
1-import { describe, expect, it, vi } from "vitest";
1+import { beforeEach, describe, expect, it, vi } from "vitest";
2233const {
44 listTeamsByName,
@@ -31,6 +31,14 @@ import {
3131resolveMSTeamsUserAllowlist,
3232} from "./resolve-allowlist.js";
333334+beforeEach(() => {
35+listTeamsByName.mockReset();
36+listChannelsForTeam.mockReset();
37+normalizeQuery.mockImplementation((value: string) => value.trim().toLowerCase());
38+resolveGraphToken.mockReset().mockResolvedValue("graph-token");
39+searchGraphUsers.mockReset();
40+});
41+3442describe("resolveMSTeamsUserAllowlist", () => {
3543it("marks empty input unresolved", async () => {
3644const [result] = await resolveMSTeamsUserAllowlist({ cfg: {}, entries: [" "] });
@@ -54,6 +62,39 @@ describe("resolveMSTeamsUserAllowlist", () => {
5462});
55635664describe("resolveMSTeamsChannelAllowlist", () => {
65+it("keeps configured Teams conversation IDs resolved without Graph lookup", async () => {
66+const [result] = await resolveMSTeamsChannelAllowlist({
67+cfg: {},
68+entries: ["19:team-general@thread.skype/19:roadmap@thread.skype"],
69+});
70+71+expect(result).toEqual({
72+input: "19:team-general@thread.skype/19:roadmap@thread.skype",
73+resolved: true,
74+teamId: "19:team-general@thread.skype",
75+teamName: "19:team-general@thread.skype",
76+channelId: "19:roadmap@thread.skype",
77+channelName: "19:roadmap@thread.skype",
78+});
79+expect(resolveGraphToken).not.toHaveBeenCalled();
80+expect(listTeamsByName).not.toHaveBeenCalled();
81+expect(listChannelsForTeam).not.toHaveBeenCalled();
82+});
83+84+it("normalizes conversation-prefixed configured channel IDs", async () => {
85+const [result] = await resolveMSTeamsChannelAllowlist({
86+cfg: {},
87+entries: ["19:team-general@thread.tacv2/conversation:19:roadmap@thread.tacv2"],
88+});
89+90+expect(result).toMatchObject({
91+resolved: true,
92+teamId: "19:team-general@thread.tacv2",
93+channelId: "19:roadmap@thread.tacv2",
94+});
95+expect(resolveGraphToken).not.toHaveBeenCalled();
96+});
97+5798it("resolves team/channel by team name + channel display name", async () => {
5899// After the fix, listChannelsForTeam is called once and reused for both
59100// General channel resolution and channel matching.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。