diff --git a/apps/backend/src/services/team-alignment.spec.ts b/apps/backend/src/services/team-alignment.spec.ts index e1abb40..517203c 100644 --- a/apps/backend/src/services/team-alignment.spec.ts +++ b/apps/backend/src/services/team-alignment.spec.ts @@ -19,6 +19,9 @@ jest.mock('../utils/count-lines', () => ({ jest.mock('../infrastructure/config', () => ({ loadConfig: jest.fn(() => ({ ...emptyConfig, + aliases: { + 'Mäster, Max': 'Max Mäster', + }, teams: { alpha: ['John Doe'], beta: ['Jane Doe', 'Max Muster'], @@ -54,6 +57,14 @@ jest.mock('../infrastructure/log', () => ({ "Jane Doe ,${now.toISOString()}" 20\t0\t/shell/my.component.ts 0\t1\t/shell/my-other.component.ts + +"Mäster, Max ,${now.toISOString()}" +10\t0\t/booking/feature-manage/my.component.ts +0\t1\t/checkin/feature-checkin/my.component.ts + +"Max Ma\u0308ster ,${now.toISOString()}" +0\t20\t/checkin/feature-checkin/my.component.ts +0\t1\t/shared/feature-checkin/my.component.ts ` ), })); @@ -158,4 +169,48 @@ describe('team alignment service', () => { }, }); }); + + it('should treat usernames with composed and decomposed umlauts as identical', async () => { + const limits: Limits = { + limitCommits: 7, + limitMonths: 0, + }; + + const result = await calcTeamAlignment(true, limits, defaultOptions); + + expect(result.modules).toEqual({ + '/booking': { + changes: { + 'Jane Doe': 10, + 'John Doe': 2, + 'Max Muster': 10, + 'Max Mäster': 10, + }, + }, + '/checkin': { + changes: { + 'Jane Doe': 1, + 'John Doe': 20, + 'Maria Muster': 20, + 'Max Mäster': 21, + }, + }, + '/shared': { + changes: { + 'John Doe': 1, + 'Maria Muster': 1, + 'Max Muster': 1, + 'Max Mäster': 1, + }, + }, + }); + + expect(result.teams).toEqual([ + 'Jane Doe', + 'John Doe', + 'Maria Muster', + 'Max Muster', + 'Max Mäster', + ]); + }); }); diff --git a/apps/backend/src/services/team-alignment.ts b/apps/backend/src/services/team-alignment.ts index ad204ad..c489b75 100644 --- a/apps/backend/src/services/team-alignment.ts +++ b/apps/backend/src/services/team-alignment.ts @@ -50,7 +50,7 @@ export async function calcTeamAlignment( } } - userName = config.aliases?.[userName] || userName; + userName = (config.aliases?.[userName] || userName).normalize('NFC'); const key = calcKey(byUser, userName, userToTeam); actualTeams.add(key);