@@ -76,6 +76,23 @@ describe('user-matchers', () => {
7676 expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
7777 } )
7878
79+ it ( 'should match case-insensitively by email when provided' , ( ) => {
80+ const params : MatchParams = { email : 'test@example.com' }
81+ const matchers = createUserMatchers ( params )
82+
83+ const userMatch : Member = {
84+ profile : { email : 'TEST@EXAMPLE.COM' } ,
85+ } as Member
86+ const userNoMatch : Member = {
87+ profile : { email : 'other@example.com' } ,
88+ } as Member
89+
90+ // Test the email matcher with case differences
91+ expect ( matchers . length ) . toBe ( 1 )
92+ expect ( matchers [ 0 ] . check ( userMatch ) ) . toBe ( true )
93+ expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
94+ } )
95+
7996 it ( 'should match by username in email when provided' , ( ) => {
8097 const params : MatchParams = { username : 'testuser' }
8198 const matchers = createUserMatchers ( params )
@@ -92,6 +109,22 @@ describe('user-matchers', () => {
92109 expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
93110 } )
94111
112+ it ( 'should match case-insensitively by username in email when provided' , ( ) => {
113+ const params : MatchParams = { username : 'testuser' }
114+ const matchers = createUserMatchers ( params )
115+
116+ const userMatch : Member = {
117+ profile : { email : 'TESTUSER@example.com' } ,
118+ } as Member
119+ const userNoMatch : Member = {
120+ profile : { email : 'other@example.com' } ,
121+ } as Member
122+
123+ // Test the username in email matcher with case differences
124+ expect ( matchers [ 0 ] . check ( userMatch ) ) . toBe ( true )
125+ expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
126+ } )
127+
95128 it ( 'should match by display_name when username provided' , ( ) => {
96129 const params : MatchParams = { username : 'displayuser' }
97130 const matchers = createUserMatchers ( params )
@@ -108,6 +141,22 @@ describe('user-matchers', () => {
108141 expect ( matchers [ 1 ] . check ( userNoMatch ) ) . toBe ( false )
109142 } )
110143
144+ it ( 'should match case-insensitively by display_name when username provided' , ( ) => {
145+ const params : MatchParams = { username : 'displayuser' }
146+ const matchers = createUserMatchers ( params )
147+
148+ const userMatch : Member = {
149+ profile : { display_name : 'DISPLAYUSER' } ,
150+ } as Member
151+ const userNoMatch : Member = {
152+ profile : { display_name : 'otherdisplay' } ,
153+ } as Member
154+
155+ // Test the display_name matcher with case differences
156+ expect ( matchers [ 1 ] . check ( userMatch ) ) . toBe ( true )
157+ expect ( matchers [ 1 ] . check ( userNoMatch ) ) . toBe ( false )
158+ } )
159+
111160 it ( 'should match by real_name when username provided' , ( ) => {
112161 const params : MatchParams = { username : 'Real User' }
113162 const matchers = createUserMatchers ( params )
@@ -124,6 +173,22 @@ describe('user-matchers', () => {
124173 expect ( matchers [ 2 ] . check ( userNoMatch ) ) . toBe ( false )
125174 } )
126175
176+ it ( 'should match case-insensitively by real_name when username provided' , ( ) => {
177+ const params : MatchParams = { username : 'Real User' }
178+ const matchers = createUserMatchers ( params )
179+
180+ const userMatch : Member = {
181+ profile : { real_name : 'real user' } ,
182+ } as Member
183+ const userNoMatch : Member = {
184+ profile : { real_name : 'Other Person' } ,
185+ } as Member
186+
187+ // Test the real_name matcher with case differences
188+ expect ( matchers [ 2 ] . check ( userMatch ) ) . toBe ( true )
189+ expect ( matchers [ 2 ] . check ( userNoMatch ) ) . toBe ( false )
190+ } )
191+
127192 it ( 'should create additional matchers for user mappings' , ( ) => {
128193 const userMappings : UserMapping [ ] = [ { githubUsername : 'github-user' , slackUsername : 'slack-user' } ]
129194 const params : MatchParams = { userMappings, username : 'github-user' }
@@ -195,6 +260,19 @@ describe('user-matchers', () => {
195260 expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
196261 } )
197262
263+ it ( 'should match case-insensitively through user mapping' , ( ) => {
264+ const userMappings : UserMapping [ ] = [ { githubUsername : 'github-user' , slackUsername : 'slack-name' } ]
265+ const params : MatchParams = { userMappings, username : 'github-user' }
266+ const matchers = createUserMatchers ( params )
267+
268+ const userMatch : Member = { name : 'SLACK-NAME' } as Member
269+ const userNoMatch : Member = { name : 'other-name' } as Member
270+
271+ // Test the mapping matcher with case differences
272+ expect ( matchers [ 0 ] . check ( userMatch ) ) . toBe ( true )
273+ expect ( matchers [ 0 ] . check ( userNoMatch ) ) . toBe ( false )
274+ } )
275+
198276 it ( 'should create multiple matchers for multiple mappings' , ( ) => {
199277 const userMappings : UserMapping [ ] = [
200278 { githubUsername : 'github-user' , slackUsername : 'slack-name-1' } ,
0 commit comments