Skip to content

Commit 6e4afcc

Browse files
committed
Show normalised email on check-your-mail page
1 parent 8e4f364 commit 6e4afcc

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/authentication/check-your-mail.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import {pipe} from 'fp-ts/lib/function';
22
import {isolatedPageTemplate} from '../templates/page-template';
33
import {html, safe, sanitizeString} from '../types/html';
4+
import {EmailAddress} from '../types';
5+
import {normaliseEmailAddress} from '../read-models/shared-state/normalise-email-address';
46

5-
export const checkYourMailPage = (submittedEmailAddress: string) =>
7+
export const checkYourMailPage = (submittedEmailAddress: EmailAddress) =>
68
pipe(
79
html`
810
<h1>Check your mail</h1>
911
<p>
10-
If <b>${sanitizeString(submittedEmailAddress)}</b> is linked to a
12+
If <b>${sanitizeString(normaliseEmailAddress(submittedEmailAddress))}</b> is linked to a
1113
Makespace number you should receive an email with that number.
1214
</p>
1315
<p>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {faker} from '@faker-js/faker';
2+
import {checkYourMailPage} from '../../src/authentication/check-your-mail';
3+
import {EmailAddress} from '../../src/types';
4+
5+
describe('checkYourMailPage', () => {
6+
it('shows the normalised email address rather than the submitted one', () => {
7+
const email = `${faker.string.alphanumeric(10)}@${faker.internet.domainName().toUpperCase()}` as EmailAddress;
8+
const [localPart, domain] = email.split('@');
9+
const normalisedEmail = `${localPart}@${domain.toLowerCase()}`;
10+
11+
const page = checkYourMailPage(email);
12+
13+
expect(page).toContain(normalisedEmail);
14+
expect(page).not.toContain(email);
15+
});
16+
});

0 commit comments

Comments
 (0)