-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EMS-1739): Account suspended - invalid link page (#546)
* feat(EMS-1739): account suspension - link invalid page * chore(tech): add E2E test coverage for showing authenticated header on the cookies saved page * feat(EMS-1739): rename 'link-invalid' to 'invalid-link' * feat(EMS-1739): add invalid and expired to verifyAccountReactivationToken mutation * feat(EMS-1739): fix/update E2E test. remove cypress deleteAccount 'catch and throw error'
- Loading branch information
Showing
27 changed files
with
243 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../journeys/insurance/account/suspended/invalid-link/account-suspended-invalid-link.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { INSURANCE_ROUTES as ROUTES } from '../../../../../../../constants/routes/insurance'; | ||
import { PAGES } from '../../../../../../../content-strings'; | ||
|
||
const { | ||
ACCOUNT: { | ||
SUSPENDED: { | ||
VERIFY_EMAIL, | ||
VERIFY_EMAIL_LINK_INVALID, | ||
}, | ||
}, | ||
} = ROUTES; | ||
|
||
const CONTENT_STRINGS = PAGES.INSURANCE.ACCOUNT.LINK_INVALID; | ||
|
||
context('Insurance - Account - Suspended - Verify email - Visit with an invalid token query param', () => { | ||
const baseUrl = Cypress.config('baseUrl'); | ||
const verifyEmailUrl = `${baseUrl}${VERIFY_EMAIL}`; | ||
const verifyEmailLinkInvalidUrl = `${baseUrl}${VERIFY_EMAIL_LINK_INVALID}`; | ||
|
||
before(() => { | ||
cy.createAnAccountAndBecomeBlocked({ startReactivationJourney: true }); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteAccount(); | ||
}); | ||
|
||
describe(`when the user navigates to ${VERIFY_EMAIL} with an invalid token`, () => { | ||
it(`should redirect to ${VERIFY_EMAIL_LINK_INVALID} and render core page elements`, () => { | ||
cy.navigateToUrl(`${verifyEmailUrl}?token=invalid`); | ||
|
||
cy.assertUrl(verifyEmailLinkInvalidUrl); | ||
|
||
cy.corePageChecks({ | ||
pageTitle: CONTENT_STRINGS.PAGE_TITLE, | ||
currentHref: verifyEmailUrl, | ||
assertBackLink: false, | ||
assertAuthenticatedHeader: false, | ||
assertSubmitButton: false, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/ui/server/controllers/insurance/account/invalid-link/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { TEMPLATE, PAGE_CONTENT_STRINGS, get } from '.'; | ||
import { PAGES } from '../../../../content-strings'; | ||
import { TEMPLATES } from '../../../../constants'; | ||
import { INSURANCE_ROUTES } from '../../../../constants/routes/insurance'; | ||
import insuranceCorePageVariables from '../../../../helpers/page-variables/core/insurance'; | ||
import { Request, Response } from '../../../../../types'; | ||
import { mockAccount, mockReq, mockRes } from '../../../../test-mocks'; | ||
|
||
const { | ||
ACCOUNT: { | ||
SIGN_IN: { ROOT: SIGN_IN_ROOT }, | ||
}, | ||
} = INSURANCE_ROUTES; | ||
|
||
describe('controllers/insurance/account/invalid-link', () => { | ||
let req: Request; | ||
let res: Response; | ||
|
||
beforeEach(() => { | ||
req = mockReq(); | ||
req.session.user = mockAccount; | ||
|
||
res = mockRes(); | ||
}); | ||
|
||
describe('TEMPLATE', () => { | ||
it('should have the correct template defined', () => { | ||
expect(TEMPLATE).toEqual(TEMPLATES.INSURANCE.ACCOUNT.LINK_INVALID); | ||
}); | ||
}); | ||
|
||
describe('PAGE_CONTENT_STRINGS', () => { | ||
it('should have the correct strings', () => { | ||
expect(PAGE_CONTENT_STRINGS).toEqual(PAGES.INSURANCE.ACCOUNT.LINK_INVALID); | ||
}); | ||
}); | ||
|
||
describe('get', () => { | ||
it('should render template', () => { | ||
get(req, res); | ||
|
||
const expectedVariables = { | ||
...insuranceCorePageVariables({ | ||
PAGE_CONTENT_STRINGS, | ||
BACK_LINK: req.headers.referer, | ||
}), | ||
SIGN_IN_URL: SIGN_IN_ROOT, | ||
}; | ||
|
||
expect(res.render).toHaveBeenCalledWith(TEMPLATE, expectedVariables); | ||
}); | ||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
src/ui/server/controllers/insurance/account/invalid-link/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { PAGES } from '../../../../content-strings'; | ||
import { TEMPLATES } from '../../../../constants'; | ||
import { INSURANCE_ROUTES } from '../../../../constants/routes/insurance'; | ||
import insuranceCorePageVariables from '../../../../helpers/page-variables/core/insurance'; | ||
import { Request, Response } from '../../../../../types'; | ||
|
||
const { | ||
ACCOUNT: { | ||
SIGN_IN: { ROOT: SIGN_IN_ROOT }, | ||
}, | ||
} = INSURANCE_ROUTES; | ||
|
||
export const TEMPLATE = TEMPLATES.INSURANCE.ACCOUNT.LINK_INVALID; | ||
|
||
export const PAGE_CONTENT_STRINGS = PAGES.INSURANCE.ACCOUNT.LINK_INVALID; | ||
|
||
/** | ||
* get | ||
* Render the generic "Account - invalid link" page | ||
* @param {Express.Request} Express request | ||
* @param {Express.Response} Express response | ||
* @returns {Express.Response.render} Generic "Account - invalid link" page | ||
*/ | ||
export const get = (req: Request, res: Response) => | ||
res.render(TEMPLATE, { | ||
...insuranceCorePageVariables({ | ||
PAGE_CONTENT_STRINGS, | ||
BACK_LINK: req.headers.referer, | ||
}), | ||
SIGN_IN_URL: SIGN_IN_ROOT, | ||
}); |
Oops, something went wrong.