The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/unit/lib/utils/normalizeUsername.spec.ts

21 lines
607 B

import { expect } from 'chai';
import { normalizeUsername } from '../../../../lib/utils/normalizeUsername';
describe('normalizeUsername', () => {
const testCases = [
['john.doe', 'john.doe'],
['@john.doe:matrix.org', 'john.doe:matrix.org'],
['@john', 'john'],
['@@john', '@john'],
['john@doe', 'john@doe'],
['', ''],
] as const;
testCases.forEach(([parameter, expectedResult]) => {
it(`should return ${JSON.stringify(expectedResult)} for ${JSON.stringify(parameter)}`, () => {
const result = normalizeUsername(parameter);
expect(result).to.be.equal(expectedResult);
});
});
});