diff --git a/__tests__/teams.test.ts b/__tests__/teams.test.ts index 287f26a13..32676b43f 100644 --- a/__tests__/teams.test.ts +++ b/__tests__/teams.test.ts @@ -26,6 +26,19 @@ test('Should add team label when the author is found', () => { expect(output).toEqual(['LightSide']) }) +test('Should be able to detect users with different username casings', () => { + // Given + const author = '@Anakin' + const labelGlobs = new Map() + labelGlobs.set('LightSide', ['@Yoda', '@ANAKIN']) + + // When + const output = getTeamLabel(labelGlobs, author) + + // Expect + expect(output).toEqual(['LightSide']) +}) + test('Should be able to detect when a user is in multiple teams', () => { // Given const author = '@Anakin' diff --git a/src/teams.ts b/src/teams.ts index 9b676683a..b9c1bc9ec 100644 --- a/src/teams.ts +++ b/src/teams.ts @@ -3,7 +3,9 @@ export function getTeamLabel( author: string ): string[] { const labels: string[] = [] - for (const [label, authors] of labelsConfiguration.entries()) - if (authors.includes(author)) labels.push(label) + for (const [label, authors] of labelsConfiguration.entries()) { + if (authors.some(a => a.toLowerCase() === author.toLowerCase())) + labels.push(label) + } return labels }