File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 11import { pipe } from 'fp-ts/lib/function' ;
22import { isolatedPageTemplate } from '../templates/page-template' ;
33import { 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 >
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments