Skip to content

Commit

Permalink
updated tests for suggestions algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
balsa-asanovic committed Feb 26, 2024
1 parent 11db225 commit 3cbb674
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/src/components/users/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import { suggestUsernames } from "./utils";

describe('suggestUsernames', () => {
test('handles basic single name', () => {
expect(suggestUsernames('John')).toEqual(expect.arrayContaining(['john', 'j']));
expect(suggestUsernames('John')).toEqual(expect.arrayContaining(['john']));
});

test('handles basic two-part name', () => {
expect(suggestUsernames('John Doe')).toEqual(expect.arrayContaining(['john', 'jdoe', 'johnd', 'johndoe']));
});

test('handles name with middle initial', () => {
expect(suggestUsernames('John Q. Doe')).toEqual(expect.arrayContaining(['john', 'jq', 'jqdoe', 'johnqd', 'johnqdoe']));
expect(suggestUsernames('John Q. Doe')).toEqual(expect.arrayContaining(['john', 'jqdoe', 'johnqd', 'johnqdoe']));
});

test('normalizes accented characters', () => {
Expand All @@ -47,7 +47,7 @@ describe('suggestUsernames', () => {
});

test('handles long name with multiple parts', () => {
expect(suggestUsernames("Maria del Carmen Fernandez Vega")).toEqual(expect.arrayContaining(['maria', 'mdel', 'mdelcarmenfernandezvega', 'mariadcfv', 'mdcfvega', 'mariadelcarmenfernandezvega']));
expect(suggestUsernames("Maria del Carmen Fernandez Vega")).toEqual(expect.arrayContaining(['maria', 'mdelcarmenfernandezvega', 'mariadcfv', 'mdcfvega', 'mariadelcarmenfernandezvega']));
});

test('handles empty or invalid input', () => {
Expand Down

0 comments on commit 3cbb674

Please sign in to comment.