@@ -6,6 +6,27 @@ import {
66 resolveMSTeamsRouteConfig ,
77} from "./policy.js" ;
88
9+ function resolveNamedTeamRouteConfig ( allowNameMatching = false ) {
10+ const cfg : MSTeamsConfig = {
11+ teams : {
12+ "My Team" : {
13+ requireMention : true ,
14+ channels : {
15+ "General Chat" : { requireMention : false } ,
16+ } ,
17+ } ,
18+ } ,
19+ } ;
20+
21+ return resolveMSTeamsRouteConfig ( {
22+ cfg,
23+ teamName : "My Team" ,
24+ channelName : "General Chat" ,
25+ conversationId : "ignored" ,
26+ allowNameMatching,
27+ } ) ;
28+ }
29+
930describe ( "msteams policy" , ( ) => {
1031 describe ( "resolveMSTeamsRouteConfig" , ( ) => {
1132 it ( "returns team and channel config when present" , ( ) => {
@@ -51,48 +72,15 @@ describe("msteams policy", () => {
5172 } ) ;
5273
5374 it ( "blocks team and channel name matches by default" , ( ) => {
54- const cfg : MSTeamsConfig = {
55- teams : {
56- "My Team" : {
57- requireMention : true ,
58- channels : {
59- "General Chat" : { requireMention : false } ,
60- } ,
61- } ,
62- } ,
63- } ;
64-
65- const res = resolveMSTeamsRouteConfig ( {
66- cfg,
67- teamName : "My Team" ,
68- channelName : "General Chat" ,
69- conversationId : "ignored" ,
70- } ) ;
75+ const res = resolveNamedTeamRouteConfig ( ) ;
7176
7277 expect ( res . teamConfig ) . toBeUndefined ( ) ;
7378 expect ( res . channelConfig ) . toBeUndefined ( ) ;
7479 expect ( res . allowed ) . toBe ( false ) ;
7580 } ) ;
7681
7782 it ( "matches team and channel by name when dangerous name matching is enabled" , ( ) => {
78- const cfg : MSTeamsConfig = {
79- teams : {
80- "My Team" : {
81- requireMention : true ,
82- channels : {
83- "General Chat" : { requireMention : false } ,
84- } ,
85- } ,
86- } ,
87- } ;
88-
89- const res = resolveMSTeamsRouteConfig ( {
90- cfg,
91- teamName : "My Team" ,
92- channelName : "General Chat" ,
93- conversationId : "ignored" ,
94- allowNameMatching : true ,
95- } ) ;
83+ const res = resolveNamedTeamRouteConfig ( true ) ;
9684
9785 expect ( res . teamConfig ?. requireMention ) . toBe ( true ) ;
9886 expect ( res . channelConfig ?. requireMention ) . toBe ( false ) ;
0 commit comments