fix(api): add toLowerCase method to email (#38586)

This commit is contained in:
Shaun Hamilton
2020-04-24 11:53:29 +01:00
committed by GitHub
parent ce82ec9647
commit b1ea426f51
5 changed files with 75 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
/* global expect */
import { ensureLowerCaseEmail } from './User-Identity';
test('returns lowercase email when one exists', () => {
const profile = {
id: 2,
emails: [{ value: 'Example@Mail.com', name: 'John Doe' }]
};
expect(ensureLowerCaseEmail(profile)).toBe('example@mail.com');
});
test('returns empty string when value is undefined', () => {
const profile = {
id: 4,
emails: []
};
expect(ensureLowerCaseEmail(profile)).toBe('');
});
test('returns empty string when emails is undefined', () => {
const profile = {
id: 5
};
expect(ensureLowerCaseEmail(profile)).toBe('');
});
test('returns empty string when profile is undefined', () => {
let profile;
expect(ensureLowerCaseEmail(profile)).toBe('');
});