From beb52dbc3ff6f604a75e3f49ce70c5967b2d90c9 Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 12:36:31 +0000 Subject: [PATCH 1/6] fix(EMS-4100): country risk logic - quote - no online support --- .../complete-and-submit-buyer-country-form.js | 1 + e2e-tests/constants/routes/quote.js | 2 +- e2e-tests/content-strings/pages/index.js | 14 +++ e2e-tests/fixtures/countries.js | 7 +- ...y-country-only-get-a-quote-offline.spec.js | 56 --------- .../buyer-country-no-online-support.spec.js | 119 ++++++++++++++++++ .../journeys/quote/cannot-apply-page.spec.js | 11 +- .../talk-to-an-export-finance-manager.spec.js | 63 ++++++++++ src/ui/server/constants/routes/quote.ts | 5 + src/ui/server/constants/templates/index.ts | 1 + .../templates/insurance/eligibility/index.ts | 1 - src/ui/server/content-strings/pages/index.ts | 14 +++ .../pages/insurance/eligibility/index.ts | 14 --- .../index.test.ts | 4 +- .../index.ts | 6 +- .../buyer-country/country-redirects.test.ts | 18 +-- .../controllers/quote/buyer-country/index.ts | 12 +- .../index.test.ts | 39 ++++++ .../index.ts | 21 ++++ .../quote/index.test.ts | 26 ++-- .../required-data-provided/quote/index.ts | 15 ++- .../insurance/eligibility/index.test.ts | 4 +- .../routes/insurance/eligibility/index.ts | 4 +- src/ui/server/routes/quote/index.test.ts | 4 +- src/ui/server/routes/quote/index.ts | 2 + .../talk-to-an-export-finance-manager.njk | 0 26 files changed, 334 insertions(+), 129 deletions(-) delete mode 100644 e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-country-only-get-a-quote-offline.spec.js create mode 100644 e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-no-online-support.spec.js create mode 100644 e2e-tests/quote/cypress/e2e/journeys/quote/talk-to-an-export-finance-manager.spec.js create mode 100644 src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts create mode 100644 src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts rename src/ui/templates/{insurance/eligibility => }/talk-to-an-export-finance-manager.njk (100%) diff --git a/e2e-tests/commands/shared-commands/eligibility/complete-and-submit-buyer-country-form.js b/e2e-tests/commands/shared-commands/eligibility/complete-and-submit-buyer-country-form.js index 13a9b44a9f..bd39163e19 100644 --- a/e2e-tests/commands/shared-commands/eligibility/complete-and-submit-buyer-country-form.js +++ b/e2e-tests/commands/shared-commands/eligibility/complete-and-submit-buyer-country-form.js @@ -14,6 +14,7 @@ export const completeAndSubmitBuyerCountryForm = ({ countryName = ONLINE_SUPPORT cy.keyboardInput(autoCompleteField(FIELD_ID).input(), countryName); const results = autoCompleteField(FIELD_ID).results(); results.first().click(); + cy.clickSubmitButton(); }; diff --git a/e2e-tests/constants/routes/quote.js b/e2e-tests/constants/routes/quote.js index 45735fbe28..599a4a4f9e 100644 --- a/e2e-tests/constants/routes/quote.js +++ b/e2e-tests/constants/routes/quote.js @@ -24,7 +24,7 @@ export const QUOTE_ROUTES = { CANNOT_APPLY_EXIT: '/quote/cannot-apply', - GET_A_QUOTE_BY_EMAIL: '/quote/get-quote-by-email', + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: '/quote/talk-to-an-export-finance-manager', YOUR_QUOTE: '/quote/your-quote', diff --git a/e2e-tests/content-strings/pages/index.js b/e2e-tests/content-strings/pages/index.js index c210a8791e..ab501d19b3 100644 --- a/e2e-tests/content-strings/pages/index.js +++ b/e2e-tests/content-strings/pages/index.js @@ -30,6 +30,19 @@ const CANNOT_APPLY_EXIT = { ACTIONS, }; +const TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT = { + PAGE_TITLE: 'Talk to an export finance manager', + INTRO: "We do not normally offer short term cover for the country you've selected.", + CONTACT_EFM: { + INTRO: 'You might still be able to apply for credit insurance through UKEF - contact', + LINK: { + TEXT: 'your nearest export finance manager', + HREF: LINKS.EXTERNAL.EXPORT_FINANCE_MANAGERS, + }, + TEXT: `to learn more about your options.`, + }, +}; + const ACCESSIBILITY_STATEMENT_PAGE = { PAGE_TITLE: 'Apply for credit insurance - accessibility statement', HEADING: 'Apply for credit insurance - accessibility statement', @@ -218,6 +231,7 @@ const PAGES = { EXPORTER_LOCATION, UK_GOODS_OR_SERVICES, CANNOT_APPLY_EXIT, + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, ACCESSIBILITY_STATEMENT_PAGE, COOKIES_PAGE, COOKIES_SAVED_PAGE, diff --git a/e2e-tests/fixtures/countries.js b/e2e-tests/fixtures/countries.js index e145f5e449..c8f318ba0a 100644 --- a/e2e-tests/fixtures/countries.js +++ b/e2e-tests/fixtures/countries.js @@ -5,7 +5,7 @@ export const AGO = { export const ARG = { NAME: 'Argentina', - ISO_CODE: 'AGO', + ISO_CODE: 'ARG', }; export const BLZ = { @@ -86,6 +86,11 @@ const NOT_SUPPORTED_4 = NCL; export const COUNTRY_QUOTE_SUPPORT = { ONLINE_SUPPORT_1, NO_ONLINE_SUPPORT_1, + NO_ONLINE_SUPPORT_2, + NO_ONLINE_SUPPORT_3, + NO_ONLINE_SUPPORT_4, + NO_ONLINE_SUPPORT_5, + NO_ONLINE_SUPPORT_6, NOT_SUPPORTED_1, }; diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-country-only-get-a-quote-offline.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-country-only-get-a-quote-offline.spec.js deleted file mode 100644 index 961d219d97..0000000000 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-country-only-get-a-quote-offline.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -import { backLink, autoCompleteField } from '../../../../../../pages/shared'; -import { ROUTES, FIELD_IDS } from '../../../../../../constants'; -import { LINKS } from '../../../../../../content-strings'; -import { COUNTRY_QUOTE_SUPPORT } from '../../../../../../fixtures/countries'; - -const { - QUOTE: { BUYER_COUNTRY, GET_A_QUOTE_BY_EMAIL }, -} = ROUTES; - -const FIELD_ID = FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY; - -const COUNTRY_NAME = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_1.NAME; - -const baseUrl = Cypress.config('baseUrl'); - -context( - 'Buyer country page - as an exporter, I want to check if UKEF issue credit insurance cover for where my buyer is based - submit country that can only get a quote offline', - () => { - const url = `${baseUrl}${BUYER_COUNTRY}`; - - beforeEach(() => { - cy.navigateToUrl(url); - cy.assertUrl(url); - - cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME); - - const results = autoCompleteField(FIELD_ID).results(); - results.first().click(); - - cy.clickSubmitButton(); - }); - - it('redirects to `get a quote via email` exit page', () => { - const expectedUrl = `${baseUrl}${GET_A_QUOTE_BY_EMAIL}`; - - cy.assertUrl(expectedUrl); - }); - - it('renders a back link with correct url', () => { - cy.checkLink(backLink(), BUYER_COUNTRY, LINKS.BACK); - }); - - it('should prepopulate the field when going back to the page via back link', () => { - cy.clickBackLink(); - - const expectedValue = COUNTRY_NAME; - - cy.checkTextAndValue({ - textSelector: autoCompleteField(FIELD_ID).results(), - expectedText: expectedValue, - valueSelector: autoCompleteField(FIELD_ID), - expectedValue, - }); - }); - }, -); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-no-online-support.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-no-online-support.spec.js new file mode 100644 index 0000000000..3c650801fe --- /dev/null +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country-no-online-support.spec.js @@ -0,0 +1,119 @@ +import { autoCompleteField } from '../../../../../../pages/shared'; +import { ROUTES, FIELD_IDS } from '../../../../../../constants'; +import { COUNTRY_QUOTE_SUPPORT } from '../../../../../../fixtures/countries'; + +const { + QUOTE: { BUYER_COUNTRY, TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT }, +} = ROUTES; + +const FIELD_ID = FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY; + +const COUNTRY_NAME_1 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_1.NAME; +const COUNTRY_NAME_2 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_2.NAME; +const COUNTRY_NAME_3 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_3.NAME; +const COUNTRY_NAME_4 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_4.NAME; +const COUNTRY_NAME_5 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_5.NAME; +const COUNTRY_NAME_6 = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_6.NAME; + +const baseUrl = Cypress.config('baseUrl'); + +context( + 'Buyer country page - as an exporter, I want to check if UKEF issue credit insurance cover for where my buyer is based - submit countries that have no online insurance support', + () => { + const buyerCountryUrl = `${baseUrl}${BUYER_COUNTRY}`; + const talkToEfmUrl = `${baseUrl}${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT}`; + + beforeEach(() => { + cy.saveSession(); + + cy.navigateToUrl(buyerCountryUrl); + }); + + describe(COUNTRY_NAME_1, () => { + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_1); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + + cy.assertUrl(talkToEfmUrl); + }); + }); + + describe(COUNTRY_NAME_2, () => { + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_2); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + + cy.assertUrl(talkToEfmUrl); + }); + }); + + describe(COUNTRY_NAME_3, () => { + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_3); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + + cy.assertUrl(talkToEfmUrl); + }); + }); + + describe(COUNTRY_NAME_4, () => { + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_4); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + + cy.assertUrl(talkToEfmUrl); + }); + }); + + describe(COUNTRY_NAME_5, () => { + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_5); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + + cy.assertUrl(talkToEfmUrl); + }); + }); + + describe(COUNTRY_NAME_6, () => { + beforeEach(() => { + cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_6); + + const results = autoCompleteField(FIELD_ID).results(); + results.first().click(); + cy.clickSubmitButton(); + }); + + it(`should redirect to ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT} exit page`, () => { + cy.assertUrl(talkToEfmUrl); + }); + + it('should prepopulate the field when going back to the page', () => { + cy.clickBackLink(); + + const expectedValue = COUNTRY_NAME_6; + + cy.checkTextAndValue({ + textSelector: autoCompleteField(FIELD_ID).results(), + expectedText: expectedValue, + valueSelector: autoCompleteField(FIELD_ID), + expectedValue, + }); + }); + }); + }, +); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-apply-page.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-apply-page.spec.js index 7cf2014fb8..a04fc031df 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-apply-page.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-apply-page.spec.js @@ -11,22 +11,21 @@ const { const baseUrl = Cypress.config('baseUrl'); context('Cannot apply exit page', () => { + const ukGoodsOrServicesUrl = `${baseUrl}${UK_GOODS_OR_SERVICES}`; + const cannotApplyUrl = `${baseUrl}${CANNOT_APPLY_EXIT}`; + beforeEach(() => { cy.navigateToRootUrl(); cy.completeAndSubmitBuyerCountryForm({}); cy.completeAndSubmitBuyerBodyForm(); cy.completeAndSubmitExporterLocationForm(); - let expectedUrl = `${baseUrl}${UK_GOODS_OR_SERVICES}`; - - cy.assertUrl(expectedUrl); + cy.assertUrl(ukGoodsOrServicesUrl); cy.clickNoRadioInput(); cy.clickSubmitButton(); - expectedUrl = `${baseUrl}${CANNOT_APPLY_EXIT}`; - - cy.assertUrl(expectedUrl); + cy.assertUrl(cannotApplyUrl); }); it('renders core page elements', () => { diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/talk-to-an-export-finance-manager.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/talk-to-an-export-finance-manager.spec.js new file mode 100644 index 0000000000..173289748e --- /dev/null +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/talk-to-an-export-finance-manager.spec.js @@ -0,0 +1,63 @@ +import { actions } from '../../../../../pages/shared'; +import { PAGES } from '../../../../../content-strings'; +import { ROUTES } from '../../../../../constants/routes'; +import { COUNTRY_QUOTE_SUPPORT } from '../../../../../fixtures/countries'; + +const CONTENT_STRINGS = PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; + +const { CONTACT_EFM } = CONTENT_STRINGS; + +const { + QUOTE: { BUYER_COUNTRY, TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT }, +} = ROUTES; + +const COUNTRY_NAME = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_1.NAME; + +const baseUrl = Cypress.config('baseUrl'); + +context('Talk to an export finance manager exit page', () => { + const url = `${baseUrl}${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT}`; + + beforeEach(() => { + cy.navigateToRootUrl(); + cy.completeAndSubmitBuyerCountryForm({ countryName: COUNTRY_NAME }); + + cy.assertUrl(url); + }); + + it('renders core page elements', () => { + cy.corePageChecks({ + pageTitle: CONTENT_STRINGS.PAGE_TITLE, + backLink: BUYER_COUNTRY, + currentHref: TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, + hasAForm: false, + assertAuthenticatedHeader: false, + isInsurancePage: false, + assertSaveAndBackButtonDoesNotExist: true, + }); + }); + + describe('page tests', () => { + beforeEach(() => { + cy.saveSession(); + + cy.navigateToUrl(url); + }); + + it('should render an intro copy', () => { + cy.checkIntroText(CONTENT_STRINGS.INTRO); + }); + + it('should render the `CONTACT EFM` intro', () => { + cy.checkText(actions.intro(), CONTACT_EFM.INTRO); + }); + + it('should render the `CONTACT EFM` link and text', () => { + cy.checkActionTalkToYourNearestEFM({ + expectedText: `${CONTACT_EFM.LINK.TEXT} ${CONTACT_EFM.TEXT}`, + expectedLinkHref: CONTACT_EFM.LINK.HREF, + expectedLinkText: CONTACT_EFM.LINK.TEXT, + }); + }); + }); +}); diff --git a/src/ui/server/constants/routes/quote.ts b/src/ui/server/constants/routes/quote.ts index 1dd1a96d95..60c019eb72 100644 --- a/src/ui/server/constants/routes/quote.ts +++ b/src/ui/server/constants/routes/quote.ts @@ -1,6 +1,9 @@ export const QUOTE_ROUTES = { START: '/', + // TODO + // TODOa + // TODO: rename to TYPE_OF_BUYER BUYER_BODY: '/quote/type-of-buyer', BUYER_COUNTRY: '/quote/buyer-country', @@ -24,6 +27,8 @@ export const QUOTE_ROUTES = { GET_A_QUOTE_BY_EMAIL: '/quote/get-quote-by-email', + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: '/quote/talk-to-an-export-finance-manager', + YOUR_QUOTE: '/quote/your-quote', NEED_TO_START_AGAIN_EXIT: '/quote/need-to-start-again', diff --git a/src/ui/server/constants/templates/index.ts b/src/ui/server/constants/templates/index.ts index 7b4c0cf080..2fca69bbc4 100644 --- a/src/ui/server/constants/templates/index.ts +++ b/src/ui/server/constants/templates/index.ts @@ -9,6 +9,7 @@ export const TEMPLATES = { COOKIES_SAVED: 'cookies-saved.njk', PROBLEM_WITH_SERVICE: 'problem-with-service.njk', CANNOT_APPLY_EXIT: 'cannot-apply.njk', + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: 'talk-to-an-export-finance-manager.njk', CONTACT_US: 'contact-us.njk', QUOTE: QUOTE_TEMPLATES, INSURANCE: INSURANCE_TEMPLATES, diff --git a/src/ui/server/constants/templates/insurance/eligibility/index.ts b/src/ui/server/constants/templates/insurance/eligibility/index.ts index 5f6ac216d7..eeca94a4ba 100644 --- a/src/ui/server/constants/templates/insurance/eligibility/index.ts +++ b/src/ui/server/constants/templates/insurance/eligibility/index.ts @@ -13,5 +13,4 @@ export const ELIGIBILITY_TEMPLATES = { CANNOT_APPLY_MULTIPLE_RISKS_EXIT: 'insurance/eligibility/cannot-apply-multiple-risks.njk', CHECK_YOUR_ANSWERS: 'insurance/eligibility/check-your-answers.njk', ELIGIBLE_TO_APPLY_ONLINE: 'insurance/eligibility/eligible-to-apply-online.njk', - TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: 'insurance/eligibility/talk-to-an-export-finance-manager.njk', }; diff --git a/src/ui/server/content-strings/pages/index.ts b/src/ui/server/content-strings/pages/index.ts index 1d2a3e2d53..980569668d 100644 --- a/src/ui/server/content-strings/pages/index.ts +++ b/src/ui/server/content-strings/pages/index.ts @@ -30,6 +30,19 @@ const CANNOT_APPLY_EXIT = { ACTIONS, }; +const TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT = { + PAGE_TITLE: 'Talk to an export finance manager', + INTRO: "We do not normally offer short term cover for the country you've selected.", + CONTACT_EFM: { + INTRO: 'You might still be able to apply for credit insurance through UKEF - contact', + LINK: { + TEXT: 'your nearest export finance manager', + HREF: LINKS.EXTERNAL.EXPORT_FINANCE_MANAGERS, + }, + TEXT: `to learn more about your options.`, + }, +}; + const ACCESSIBILITY_STATEMENT_PAGE = { PAGE_TITLE: 'Apply for credit insurance - accessibility statement', HEADING: 'Apply for credit insurance - accessibility statement', @@ -215,6 +228,7 @@ export const PAGES = { ACTIONS, UK_GOODS_OR_SERVICES, CANNOT_APPLY_EXIT, + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, COOKIES_PAGE, COOKIES_SAVED_PAGE, ACCESSIBILITY_STATEMENT_PAGE, diff --git a/src/ui/server/content-strings/pages/insurance/eligibility/index.ts b/src/ui/server/content-strings/pages/insurance/eligibility/index.ts index 7669a02464..a6226b42fc 100644 --- a/src/ui/server/content-strings/pages/insurance/eligibility/index.ts +++ b/src/ui/server/content-strings/pages/insurance/eligibility/index.ts @@ -168,19 +168,6 @@ const HAVE_AN_ACCOUNT = { PAGE_TITLE: 'Do you have an account with us?', }; -const TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT = { - PAGE_TITLE: 'Talk to an export finance manager', - INTRO: "We do not normally offer short term cover for the country you've selected.", - CONTACT_EFM: { - INTRO: 'You might still be able to apply for credit insurance through UKEF - contact', - LINK: { - TEXT: 'your nearest export finance manager', - HREF: LINKS.EXTERNAL.EXPORT_FINANCE_MANAGERS, - }, - TEXT: `to learn more about your options.`, - }, -}; - const PARTY_TO_CONSORTIUM = { PAGE_TITLE: 'Are you, or will you be a party to any consortium in connection with the performance or financing of any part of the export contract(s)?', }; @@ -206,7 +193,6 @@ export default { CHECK_YOUR_ANSWERS, ELIGIBLE_TO_APPLY_ONLINE, HAVE_AN_ACCOUNT, - TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, PARTY_TO_CONSORTIUM, MEMBER_OF_A_GROUP, MEMBER_OF_A_GROUP_EXIT, diff --git a/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.test.ts b/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.test.ts index c73433ec0e..aa48ca8bd3 100644 --- a/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.test.ts +++ b/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.test.ts @@ -17,7 +17,7 @@ describe('controllers/insurance/eligibility/talk-to-an-export-finance-manager', describe('TEMPLATE', () => { it('should have the correct template defined', () => { - expect(TEMPLATE).toEqual(TEMPLATES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT); + expect(TEMPLATE).toEqual(TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT); }); }); @@ -27,7 +27,7 @@ describe('controllers/insurance/eligibility/talk-to-an-export-finance-manager', const expectedVariables = { ...corePageVariables({ - PAGE_CONTENT_STRINGS: PAGES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, + PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, BACK_LINK: req.headers.referer, }), userName: getUserNameFromSession(req.session.user), diff --git a/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.ts b/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.ts index 510a07c1db..d70bfff786 100644 --- a/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.ts +++ b/src/ui/server/controllers/insurance/eligibility/talk-to-an-export-finance-manager/index.ts @@ -4,11 +4,11 @@ import { Request, Response } from '../../../../../types'; import corePageVariables from '../../../../helpers/page-variables/core/insurance'; import getUserNameFromSession from '../../../../helpers/get-user-name-from-session'; -export const TEMPLATE = TEMPLATES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; +export const TEMPLATE = TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; /** * get - * Render the "Talk to an export finance manager" exit page + * Render the "Insurance eligibility - Talk to an export finance manager" exit page * @param {Express.Request} Express request * @param {Express.Response} Express response * @returns {Express.Response.render} "Talk to an export finance manager" exit page @@ -16,7 +16,7 @@ export const TEMPLATE = TEMPLATES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANC export const get = (req: Request, res: Response) => res.render(TEMPLATE, { ...corePageVariables({ - PAGE_CONTENT_STRINGS: PAGES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, + PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, BACK_LINK: req.headers.referer, }), userName: getUserNameFromSession(req.session.user), diff --git a/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts b/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts index 714d76c982..ad5ecb66b5 100644 --- a/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts +++ b/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts @@ -124,24 +124,10 @@ describe('controllers/quote/buyer-country - redirects', () => { expect(req.session.submittedData.quoteEligibility).toEqual(expected); }); - it('should add previousRoute, exitReason and exitDescription to req.flash', async () => { + it(`should redirect to ${ROUTES.QUOTE.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT}`, async () => { await post(req, res); - expect(mockFlash).toHaveBeenCalledTimes(3); - - expect(mockFlash.mock.calls[0]).toEqual(['previousRoute', ROUTES.QUOTE.BUYER_COUNTRY]); - - const { GET_A_QUOTE_BY_EMAIL } = PAGES.QUOTE; - const { REASON } = GET_A_QUOTE_BY_EMAIL; - - expect(mockFlash.mock.calls[1]).toEqual(['exitReason', REASON.BUYER_COUNTRY]); - expect(mockFlash.mock.calls[2]).toEqual(['exitDescription', REASON.BUYER_COUNTRY_DESCRIPTION]); - }); - - it(`should redirect to ${ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL}`, async () => { - await post(req, res); - - expect(res.redirect).toHaveBeenCalledWith(ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL); + expect(res.redirect).toHaveBeenCalledWith(ROUTES.QUOTE.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT); }); }); diff --git a/src/ui/server/controllers/quote/buyer-country/index.ts b/src/ui/server/controllers/quote/buyer-country/index.ts index f9a392fe5c..7b920be95b 100644 --- a/src/ui/server/controllers/quote/buyer-country/index.ts +++ b/src/ui/server/controllers/quote/buyer-country/index.ts @@ -144,21 +144,13 @@ export const post = async (req: Request, res: Response) => { * redirect to a specific exit page. */ if (country.noOnlineSupport) { - console.info('Country support - %s - can get a quote by email', country.name); + console.info('Country support - %s - no online quote support available', country.name); const populatedData = mapSubmittedEligibilityCountry(country); req.session.submittedData.quoteEligibility = updateSubmittedData(populatedData, req.session.submittedData.quoteEligibility); - req.flash('previousRoute', ROUTES.QUOTE.BUYER_COUNTRY); - - const { GET_A_QUOTE_BY_EMAIL } = PAGES.QUOTE; - const { REASON } = GET_A_QUOTE_BY_EMAIL; - - req.flash('exitReason', REASON.BUYER_COUNTRY); - req.flash('exitDescription', REASON.BUYER_COUNTRY_DESCRIPTION); - - return res.redirect(ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL); + return res.redirect(ROUTES.QUOTE.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT); } /** diff --git a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts new file mode 100644 index 0000000000..a241a6be3b --- /dev/null +++ b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts @@ -0,0 +1,39 @@ +import { TEMPLATE, get } from '.'; +import { PAGES } from '../../../content-strings'; +import { TEMPLATES } from '../../../constants'; +import corePageVariables from '../../../helpers/page-variables/core/quote'; +import getUserNameFromSession from '../../../helpers/get-user-name-from-session'; +import { Request, Response } from '../../../../types'; +import { mockReq, mockRes } from '../../../test-mocks'; + +describe('controllers/quote/talk-to-an-export-finance-manager', () => { + let req: Request; + let res: Response; + + beforeEach(() => { + req = mockReq(); + + res = mockRes(); + }); + + describe('TEMPLATE', () => { + it('should have the correct template defined', () => { + expect(TEMPLATE).toEqual(TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT); + }); + }); + + describe('get', () => { + it('should render template', () => { + get(req, res); + + expect(res.render).toHaveBeenCalledWith(TEMPLATES.QUOTE.GET_A_QUOTE_BY_EMAIL, { + ...corePageVariables({ + PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, + BACK_LINK: req.headers.referer, + ORIGINAL_URL: req.originalUrl, + }), + userName: getUserNameFromSession(req.session.user), + }); + }); + }); +}); diff --git a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts new file mode 100644 index 0000000000..7e2d0d5046 --- /dev/null +++ b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts @@ -0,0 +1,21 @@ +import { PAGES } from '../../../content-strings'; +import { TEMPLATES } from '../../../constants'; +import corePageVariables from '../../../helpers/page-variables/core/quote'; +import getUserNameFromSession from '../../../helpers/get-user-name-from-session'; +import { Request, Response } from '../../../../types'; + +export const TEMPLATE = TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; + +/** + * get + * Render the "Quote - Talk to an export finance manager" exit page + * @param {Express.Request} Express request + * @param {Express.Response} Express response + * @returns {Express.Response.render} "Talk to an export finance manager" exit page + */ +export const get = (req: Request, res: Response) => { + res.render(TEMPLATE, { + ...corePageVariables({ PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, BACK_LINK: req.headers.referer, ORIGINAL_URL: req.originalUrl }), + userName: getUserNameFromSession(req.session.user), + }); +}; diff --git a/src/ui/server/middleware/required-data-provided/quote/index.test.ts b/src/ui/server/middleware/required-data-provided/quote/index.test.ts index c2054625e3..89b82f0a88 100644 --- a/src/ui/server/middleware/required-data-provided/quote/index.test.ts +++ b/src/ui/server/middleware/required-data-provided/quote/index.test.ts @@ -17,6 +17,7 @@ const { NEED_TO_START_AGAIN_EXIT, POLICY_TYPE, POLICY_TYPE_CHANGE, + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, TELL_US_ABOUT_YOUR_POLICY, TELL_US_ABOUT_YOUR_POLICY_CHANGE, YOUR_QUOTE, @@ -192,18 +193,27 @@ describe('middleware/required-data-provided/quote', () => { }); }); - describe(`when req.originalUrl is ${START}`, () => { + describe(`when req.originalUrl is ${BUYER_COUNTRY}`, () => { it('should call req.next', () => { - req.originalUrl = START; + req.originalUrl = BUYER_COUNTRY; requiredQuoteEligibilityDataProvided(req, res, nextSpy); expect(nextSpy).toHaveBeenCalled(); }); }); - describe(`when req.originalUrl is ${BUYER_COUNTRY}`, () => { + describe(`when req.originalUrl is ${CANNOT_APPLY_EXIT}`, () => { it('should call req.next', () => { - req.originalUrl = BUYER_COUNTRY; + req.originalUrl = CANNOT_APPLY_EXIT; + requiredQuoteEligibilityDataProvided(req, res, nextSpy); + + expect(nextSpy).toHaveBeenCalled(); + }); + }); + + describe(`when req.originalUrl is ${GET_A_QUOTE_BY_EMAIL}`, () => { + it('should call req.next', () => { + req.originalUrl = GET_A_QUOTE_BY_EMAIL; requiredQuoteEligibilityDataProvided(req, res, nextSpy); expect(nextSpy).toHaveBeenCalled(); @@ -219,18 +229,18 @@ describe('middleware/required-data-provided/quote', () => { }); }); - describe(`when req.originalUrl is ${CANNOT_APPLY_EXIT}`, () => { + describe(`when req.originalUrl is ${START}`, () => { it('should call req.next', () => { - req.originalUrl = CANNOT_APPLY_EXIT; + req.originalUrl = START; requiredQuoteEligibilityDataProvided(req, res, nextSpy); expect(nextSpy).toHaveBeenCalled(); }); }); - describe(`when req.originalUrl is ${GET_A_QUOTE_BY_EMAIL}`, () => { + describe(`when req.originalUrl is ${TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT}`, () => { it('should call req.next', () => { - req.originalUrl = GET_A_QUOTE_BY_EMAIL; + req.originalUrl = TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; requiredQuoteEligibilityDataProvided(req, res, nextSpy); expect(nextSpy).toHaveBeenCalled(); diff --git a/src/ui/server/middleware/required-data-provided/quote/index.ts b/src/ui/server/middleware/required-data-provided/quote/index.ts index c5f393d297..218d1d572a 100644 --- a/src/ui/server/middleware/required-data-provided/quote/index.ts +++ b/src/ui/server/middleware/required-data-provided/quote/index.ts @@ -18,6 +18,7 @@ const { NEED_TO_START_AGAIN_EXIT, POLICY_TYPE, POLICY_TYPE_CHANGE, + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, TELL_US_ABOUT_YOUR_POLICY, TELL_US_ABOUT_YOUR_POLICY_CHANGE, YOUR_QUOTE, @@ -117,14 +118,16 @@ export const requiredQuoteEligibilityDataProvided = (req: Request, res: Response const routesArray = getRoutesAsArray(ROUTES.QUOTE); // array of routes that do not require any data checks. - const irrelevantRoutes = [BUYER_COUNTRY, CANNOT_APPLY_EXIT, GET_A_QUOTE_BY_EMAIL, NEED_TO_START_AGAIN_EXIT, START]; + const IRRELEVANT_ROUTES = [BUYER_COUNTRY, CANNOT_APPLY_EXIT, GET_A_QUOTE_BY_EMAIL, NEED_TO_START_AGAIN_EXIT, START, TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT]; - const isIrrelevantRoute = (route: string) => irrelevantRoutes.includes(route); + const isIrrelevantRoute = (route: string) => IRRELEVANT_ROUTES.includes(route); - // do not run any data checks if the requested route is one of the following: - // is a route that does not require any data checks - // is 404 page - // or the request is not a GET request. + /** + * Do not run any data checks if the requested route is one of the following: + * - is a route that does not require any data checks + * - is 404 page + * - the request is not a GET request. + */ if (isIrrelevantRoute(url) || !routeIsKnown(routesArray, url) || method !== 'GET') { return next(); } diff --git a/src/ui/server/routes/insurance/eligibility/index.test.ts b/src/ui/server/routes/insurance/eligibility/index.test.ts index ab4f93c4fd..9975758a8e 100644 --- a/src/ui/server/routes/insurance/eligibility/index.test.ts +++ b/src/ui/server/routes/insurance/eligibility/index.test.ts @@ -22,7 +22,7 @@ import { get as eligibleToApplyOnlineGet, post as eligibleToApplyOnlinePost } fr import { get as haveAnAccountGet, post as haveAnAccountPost } from '../../../controllers/insurance/eligibility/do-you-have-an-account'; import { get as cannotApplyGet } from '../../../controllers/insurance/eligibility/cannot-apply'; import { get as needToStartAgainGet, post as needToStartAgainPost } from '../../../controllers/insurance/eligibility/need-to-start-again'; -import { get as contractTooShortGet } from '../../../controllers/insurance/eligibility/talk-to-an-export-finance-manager'; +import { get as talkToEfmGet } from '../../../controllers/insurance/eligibility/talk-to-an-export-finance-manager'; import { get as partyToConsortiumExitGet } from '../../../controllers/insurance/eligibility/party-to-consortium-exit'; import { get as memberOfAGroupExitGet } from '../../../controllers/insurance/eligibility/member-of-a-group-exit'; @@ -102,7 +102,7 @@ describe('routes/insurance/eligibility', () => { expect(get).toHaveBeenCalledWith(ROUTES.INSURANCE.ELIGIBILITY.NEED_TO_START_AGAIN, needToStartAgainGet); expect(post).toHaveBeenCalledWith(ROUTES.INSURANCE.ELIGIBILITY.NEED_TO_START_AGAIN, needToStartAgainPost); - expect(get).toHaveBeenCalledWith(ROUTES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, contractTooShortGet); + expect(get).toHaveBeenCalledWith(ROUTES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, talkToEfmGet); expect(get).toHaveBeenCalledWith(ROUTES.INSURANCE.ELIGIBILITY.PARTY_TO_CONSORTIUM_EXIT, partyToConsortiumExitGet); diff --git a/src/ui/server/routes/insurance/eligibility/index.ts b/src/ui/server/routes/insurance/eligibility/index.ts index 7865b47103..0b2f388eda 100644 --- a/src/ui/server/routes/insurance/eligibility/index.ts +++ b/src/ui/server/routes/insurance/eligibility/index.ts @@ -22,7 +22,7 @@ import { get as eligibleToApplyOnlineGet, post as eligibleToApplyOnlinePost } fr import { get as haveAnAccountGet, post as haveAnAccountPost } from '../../../controllers/insurance/eligibility/do-you-have-an-account'; import { get as cannotApplyGet } from '../../../controllers/insurance/eligibility/cannot-apply'; import { get as needToStartAgainGet, post as needToStartAgainPost } from '../../../controllers/insurance/eligibility/need-to-start-again'; -import { get as talkToEfmTooShortGet } from '../../../controllers/insurance/eligibility/talk-to-an-export-finance-manager'; +import { get as talkToEfmGet } from '../../../controllers/insurance/eligibility/talk-to-an-export-finance-manager'; import { get as partyToConsortiumExitGet } from '../../../controllers/insurance/eligibility/party-to-consortium-exit'; import { get as memberOfAGroupExitGet } from '../../../controllers/insurance/eligibility/member-of-a-group-exit'; @@ -111,7 +111,7 @@ insuranceEligibilityRouter.get(ROUTES.INSURANCE.ELIGIBILITY.CANNOT_APPLY_EXIT, c insuranceEligibilityRouter.get(ROUTES.INSURANCE.ELIGIBILITY.NEED_TO_START_AGAIN, needToStartAgainGet); insuranceEligibilityRouter.post(ROUTES.INSURANCE.ELIGIBILITY.NEED_TO_START_AGAIN, needToStartAgainPost); -insuranceEligibilityRouter.get(ROUTES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, talkToEfmTooShortGet); +insuranceEligibilityRouter.get(ROUTES.INSURANCE.ELIGIBILITY.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, talkToEfmGet); insuranceEligibilityRouter.get(ROUTES.INSURANCE.ELIGIBILITY.PARTY_TO_CONSORTIUM_EXIT, partyToConsortiumExitGet); diff --git a/src/ui/server/routes/quote/index.test.ts b/src/ui/server/routes/quote/index.test.ts index f82f34eaf6..e29a17468c 100644 --- a/src/ui/server/routes/quote/index.test.ts +++ b/src/ui/server/routes/quote/index.test.ts @@ -9,6 +9,7 @@ import { get as tellUsAboutYourPolicyGet, post as tellUsAboutYourPolicyPost } fr import { get as checkYourAnswersGet, post as checkYourAnswersPost } from '../../controllers/quote/check-your-answers'; import { get as cannotObtainCoverGet } from '../../controllers/quote/cannot-apply'; import { get as getAQuoteByEmailGet } from '../../controllers/quote/get-a-quote-by-email'; +import { get as talkToEfmGet } from '../../controllers/quote/talk-to-an-export-finance-manager'; import { get as yourQuoteGet } from '../../controllers/quote/your-quote'; import { get as needToStartAgainGet, post as needToStartAgainPost } from '../../controllers/quote/need-to-start-again'; @@ -22,7 +23,7 @@ describe('routes/quote', () => { }); it('should setup all routes', () => { - expect(get).toHaveBeenCalledTimes(16); + expect(get).toHaveBeenCalledTimes(17); expect(post).toHaveBeenCalledTimes(13); expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_COUNTRY, buyerCountryGet); @@ -59,6 +60,7 @@ describe('routes/quote', () => { expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.CANNOT_APPLY_EXIT, cannotObtainCoverGet); expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL, getAQuoteByEmailGet); + expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, talkToEfmGet); expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.YOUR_QUOTE, yourQuoteGet); diff --git a/src/ui/server/routes/quote/index.ts b/src/ui/server/routes/quote/index.ts index 4ee87a19b1..9d085a18fe 100644 --- a/src/ui/server/routes/quote/index.ts +++ b/src/ui/server/routes/quote/index.ts @@ -9,6 +9,7 @@ import { get as tellUsAboutYourPolicyGet, post as tellUsAboutYourPolicyPost } fr import { get as checkYourAnswersGet, post as checkYourAnswersPost } from '../../controllers/quote/check-your-answers'; import { get as cannotObtainCoverGet } from '../../controllers/quote/cannot-apply'; import { get as getAQuoteByEmailGet } from '../../controllers/quote/get-a-quote-by-email'; +import { get as talkToEfmGet } from '../../controllers/quote/talk-to-an-export-finance-manager'; import { get as yourQuoteGet } from '../../controllers/quote/your-quote'; import { get as needToStartAgainGet, post as needToStartAgainPost } from '../../controllers/quote/need-to-start-again'; @@ -49,6 +50,7 @@ quoteRouter.post(ROUTES.QUOTE.CHECK_YOUR_ANSWERS, checkYourAnswersPost); quoteRouter.get(ROUTES.QUOTE.CANNOT_APPLY_EXIT, cannotObtainCoverGet); quoteRouter.get(ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL, getAQuoteByEmailGet); +quoteRouter.get(ROUTES.QUOTE.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, talkToEfmGet); quoteRouter.get(ROUTES.QUOTE.YOUR_QUOTE, yourQuoteGet); diff --git a/src/ui/templates/insurance/eligibility/talk-to-an-export-finance-manager.njk b/src/ui/templates/talk-to-an-export-finance-manager.njk similarity index 100% rename from src/ui/templates/insurance/eligibility/talk-to-an-export-finance-manager.njk rename to src/ui/templates/talk-to-an-export-finance-manager.njk From 3c54a9baf8cb4502e6f5b26e98852044f323edb0 Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 12:42:54 +0000 Subject: [PATCH 2/6] chore(naming): rename 'buyer body' to 'type of buyer' --- .github/workflows/test.yml | 2 +- e2e-tests/constants/field-ids/index.js | 2 +- e2e-tests/constants/routes/quote.js | 2 +- e2e-tests/content-strings/error-messages.js | 2 +- e2e-tests/content-strings/pages/quote.js | 8 ++--- e2e-tests/pages/quote/buyerBody.js | 10 ------ e2e-tests/pages/quote/typeOfBuyer.js | 10 ++++++ .../quote/buyer-country/buyer-country.spec.js | 6 ++-- ...te-to-type-of-buyer-page-directly.spec.js} | 6 ++-- .../exporter-location.spec.js | 4 +-- .../type-of-buyer-answer-yes.spec.js} | 14 ++++---- .../type-of-buyer.spec.js} | 16 ++++----- ...hen-complete-insurance-eligibility.spec.js | 4 +-- ...hen-complete-insurance-eligibility.spec.js | 4 +-- src/ui/server/constants/field-ids/index.ts | 2 +- src/ui/server/constants/routes/quote.ts | 2 +- .../constants/templates/partials/index.ts | 4 +-- .../server/content-strings/error-messages.ts | 2 +- src/ui/server/content-strings/pages/quote.ts | 8 ++--- .../buyer-country/country-redirects.test.ts | 4 +-- .../controllers/quote/buyer-country/index.ts | 2 +- .../index.test.ts | 18 +++++----- .../{buyer-body => type-of-buyer}/index.ts | 22 ++++++------ .../quote/index.test.ts | 34 +++++++++---------- .../required-data-provided/quote/index.ts | 10 +++--- src/ui/server/routes/quote/index.test.ts | 6 ++-- src/ui/server/routes/quote/index.ts | 6 ++-- src/ui/server/test-mocks/mock-answers.ts | 4 +-- ...-details.njk => type-of-buyer-details.njk} | 4 +-- .../required-data-state/quote-eligibility.ts | 2 +- 30 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 e2e-tests/pages/quote/buyerBody.js create mode 100644 e2e-tests/pages/quote/typeOfBuyer.js rename e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/{navigate-to-buyer-body-page-directly.spec.js => navigate-to-type-of-buyer-page-directly.spec.js} (62%) rename e2e-tests/quote/cypress/e2e/journeys/quote/{buyer-body/buyer-body-answer-yes.spec.js => type-of-buyer/type-of-buyer-answer-yes.spec.js} (74%) rename e2e-tests/quote/cypress/e2e/journeys/quote/{buyer-body/buyer-body.spec.js => type-of-buyer/type-of-buyer.spec.js} (83%) rename src/ui/server/controllers/quote/{buyer-body => type-of-buyer}/index.test.ts (93%) rename src/ui/server/controllers/quote/{buyer-body => type-of-buyer}/index.ts (80%) rename src/ui/templates/partials/quote/{buyer-body-details.njk => type-of-buyer-details.njk} (91%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 217b62441e..f59c9119ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -882,7 +882,7 @@ jobs: '/*.spec.js', 'cookies-consent/**/*.spec.js', 'quote/*.spec.js', - 'quote/buyer-body/*.spec.js', + 'quote/type-of-buyer/*.spec.js', 'quote/buyer-country/*.spec.js', 'quote/cannot-skip-flow/*.spec.js', 'quote/change-your-answers/*.spec.js', diff --git a/e2e-tests/constants/field-ids/index.js b/e2e-tests/constants/field-ids/index.js index 70383c21f8..c56eccf991 100644 --- a/e2e-tests/constants/field-ids/index.js +++ b/e2e-tests/constants/field-ids/index.js @@ -8,7 +8,7 @@ export const FIELD_IDS = { ...SHARED, ELIGIBILITY: { ...SHARED_ELIGIBILITY_FIELD_IDS, - VALID_BUYER_BODY: 'validBuyerBody', + VALID_TYPE_OF_BUYER: 'validBuyerBody', COUNTRY: 'country', AMOUNT_CURRENCY: 'amountAndCurrency', CURRENCY: 'currency', diff --git a/e2e-tests/constants/routes/quote.js b/e2e-tests/constants/routes/quote.js index 599a4a4f9e..aed4c55a15 100644 --- a/e2e-tests/constants/routes/quote.js +++ b/e2e-tests/constants/routes/quote.js @@ -3,7 +3,7 @@ export const QUOTE_ROUTES = { ROOT: '/quote', - BUYER_BODY: '/quote/type-of-buyer', + TYPE_OF_BUYER: '/quote/type-of-buyer', BUYER_COUNTRY: '/quote/buyer-country', BUYER_COUNTRY_CHANGE: '/quote/buyer-country/change', diff --git a/e2e-tests/content-strings/error-messages.js b/e2e-tests/content-strings/error-messages.js index d890545b85..123a946232 100644 --- a/e2e-tests/content-strings/error-messages.js +++ b/e2e-tests/content-strings/error-messages.js @@ -11,7 +11,7 @@ export const ERROR_MESSAGES = { THERE_IS_A_PROBLEM: 'There is a problem', ELIGIBILITY: { [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY]: 'Select where your buyer is based', - [FIELD_IDS.ELIGIBILITY.VALID_BUYER_BODY]: 'Select if your buyer is a government or public sector body', + [FIELD_IDS.ELIGIBILITY.VALID_TYPE_OF_BUYER]: 'Select if your buyer is a government or public sector body', [FIELD_IDS.ELIGIBILITY.VALID_EXPORTER_LOCATION]: "Select whether you're exporting from a business base in the UK, Channel Islands, Isle of Man or not", [FIELD_IDS.ELIGIBILITY.HAS_MINIMUM_UK_GOODS_OR_SERVICES]: { IS_EMPTY: 'Select whether at least 20% of your export contract value is made up from UK goods or services or not', diff --git a/e2e-tests/content-strings/pages/quote.js b/e2e-tests/content-strings/pages/quote.js index 70fe3383c0..a1b3b9ac5b 100644 --- a/e2e-tests/content-strings/pages/quote.js +++ b/e2e-tests/content-strings/pages/quote.js @@ -1,6 +1,6 @@ import { LINKS } from '../links'; -const BUYER_BODY = { +const TYPE_OF_BUYER = { PAGE_TITLE: 'Is your buyer a government or public sector body?', DETAILS: { INTRO: 'What counts as a government or public sector body?', @@ -57,8 +57,8 @@ const CANNOT_APPLY_EXIT = { const GET_A_QUOTE_BY_EMAIL = { PAGE_TITLE: 'You need to get a quote by email', REASON: { - BUYER_BODY: 'We cannot give you a quote online because your buyer is a government or public sector body.', - BUYER_BODY_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', + TYPE_OF_BUYER: 'We cannot give you a quote online because your buyer is a government or public sector body.', + TYPE_OF_BUYER_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', BUYER_COUNTRY: 'We cannot give you a quote online because of the country where your buyer is based.', BUYER_COUNTRY_DESCRIPTION: "We can still give you a quote but may need extra information from you to assess the risks around your buyer's country first.", }, @@ -126,7 +126,7 @@ const YOUR_QUOTE = { }; const QUOTE = { - BUYER_BODY, + TYPE_OF_BUYER, POLICY_TYPE, TELL_US_ABOUT_YOUR_POLICY, CHECK_YOUR_ANSWERS, diff --git a/e2e-tests/pages/quote/buyerBody.js b/e2e-tests/pages/quote/buyerBody.js deleted file mode 100644 index d5391477bd..0000000000 --- a/e2e-tests/pages/quote/buyerBody.js +++ /dev/null @@ -1,10 +0,0 @@ -const buyerBodyPage = { - description: { - summary: () => cy.get('[data-cy="buyer-body"] summary'), - details: () => cy.get('[data-cy="buyer-body"]'), - body1: () => cy.get('[data-cy="details-body-1"]'), - body2: () => cy.get('[data-cy="details-body-2"]'), - }, -}; - -export default buyerBodyPage; diff --git a/e2e-tests/pages/quote/typeOfBuyer.js b/e2e-tests/pages/quote/typeOfBuyer.js new file mode 100644 index 0000000000..7c035f0f73 --- /dev/null +++ b/e2e-tests/pages/quote/typeOfBuyer.js @@ -0,0 +1,10 @@ +const typeOfBuyerPage = { + description: { + summary: () => cy.get('[data-cy="type-of-buyer"] summary'), + details: () => cy.get('[data-cy="type-of-buyer"]'), + body1: () => cy.get('[data-cy="details-body-1"]'), + body2: () => cy.get('[data-cy="details-body-2"]'), + }, +}; + +export default typeOfBuyerPage; diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country.spec.js index f9781bca7a..fb78283f8b 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-country/buyer-country.spec.js @@ -9,7 +9,7 @@ const CONTENT_STRINGS = PAGES.BUYER_COUNTRY; const FIELD_ID = FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY; const { - QUOTE: { BUYER_COUNTRY, BUYER_BODY }, + QUOTE: { BUYER_COUNTRY, TYPE_OF_BUYER }, } = ROUTES; const supportedCountryName = COUNTRY_QUOTE_SUPPORT.ONLINE_SUPPORT_1.NAME; @@ -80,8 +80,8 @@ context('Buyer country page - as an exporter, I want to check if UKEF issue cred cy.clickSubmitButton(); }); - it(`should redirect to ${BUYER_BODY}`, () => { - const expectedUrl = `${baseUrl}${BUYER_BODY}`; + it(`should redirect to ${TYPE_OF_BUYER}`, () => { + const expectedUrl = `${baseUrl}${TYPE_OF_BUYER}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-buyer-body-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js similarity index 62% rename from e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-buyer-body-page-directly.spec.js rename to e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js index f0d151f90f..21b533b0d2 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-buyer-body-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js @@ -1,14 +1,14 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { BUYER_BODY, NEED_TO_START_AGAIN }, + QUOTE: { TYPE_OF_BUYER, NEED_TO_START_AGAIN }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); -context('Manually going to the `Buyer body` via URL page without completing the previous forms', () => { +context('Manually going to the `Type of buyer` via URL page without completing the previous forms', () => { beforeEach(() => { - cy.navigateToUrl(BUYER_BODY); + cy.navigateToUrl(TYPE_OF_BUYER); }); it('should redirect to the `need to start again` exit page', () => { diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/exporter-location/exporter-location.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/exporter-location/exporter-location.spec.js index eb0196b9d5..16c23a2582 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/exporter-location/exporter-location.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/exporter-location/exporter-location.spec.js @@ -6,7 +6,7 @@ import { ROUTES, FIELD_IDS, FIELD_VALUES } from '../../../../../../constants'; const CONTENT_STRINGS = PAGES.EXPORTER_LOCATION; const { - QUOTE: { EXPORTER_LOCATION, BUYER_BODY, UK_GOODS_OR_SERVICES }, + QUOTE: { EXPORTER_LOCATION, TYPE_OF_BUYER, UK_GOODS_OR_SERVICES }, } = ROUTES; const { @@ -30,7 +30,7 @@ context('Exporter location page - as an exporter, I want to check if my company cy.corePageChecks({ pageTitle: CONTENT_STRINGS.PAGE_TITLE, currentHref: EXPORTER_LOCATION, - backLink: BUYER_BODY, + backLink: TYPE_OF_BUYER, assertAuthenticatedHeader: false, isInsurancePage: false, assertSaveAndBackButtonDoesNotExist: true, diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body-answer-yes.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer-answer-yes.spec.js similarity index 74% rename from e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body-answer-yes.spec.js rename to e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer-answer-yes.spec.js index a60aaa5eb5..887a36c649 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body-answer-yes.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer-answer-yes.spec.js @@ -4,15 +4,15 @@ import { PAGES, LINKS } from '../../../../../../content-strings'; import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { BUYER_BODY, GET_A_QUOTE_BY_EMAIL }, + QUOTE: { TYPE_OF_BUYER, GET_A_QUOTE_BY_EMAIL }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); context( - 'Buyer body page - as an exporter, I want to check if I can get an EXIP online quote for my buyers country - submit `buyer is a government or public sector body`', + 'Type of buyer page - as an exporter, I want to check if I can get an EXIP online quote for my buyers country - submit `buyer is a government or public sector body`', () => { - const url = `${baseUrl}${BUYER_BODY}`; + const url = `${baseUrl}${TYPE_OF_BUYER}`; before(() => { cy.navigateToRootUrl(); @@ -37,18 +37,18 @@ context( }); it('renders a back link with correct url', () => { - cy.checkLink(backLink(), BUYER_BODY, LINKS.BACK); + cy.checkLink(backLink(), TYPE_OF_BUYER, LINKS.BACK); }); it('renders a specific reason and description', () => { - const expectedReason = PAGES.QUOTE.GET_A_QUOTE_BY_EMAIL.REASON.BUYER_BODY; + const expectedReason = PAGES.QUOTE.GET_A_QUOTE_BY_EMAIL.REASON.TYPE_OF_BUYER; cy.checkText(getAQuoteByEmailPage.reason(), expectedReason); - const expectedDescription = PAGES.QUOTE.GET_A_QUOTE_BY_EMAIL.REASON.BUYER_BODY_DESCRIPTION; + const expectedDescription = PAGES.QUOTE.GET_A_QUOTE_BY_EMAIL.REASON.TYPE_OF_BUYER_DESCRIPTION; cy.checkText(getAQuoteByEmailPage.description(), expectedDescription); }); - describe('navigating back to the buyer body page', () => { + describe('navigating back to the type of buyer page', () => { it('auto checks the previously submitted answer', () => { cy.clickBackLink(); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer.spec.js similarity index 83% rename from e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body.spec.js rename to e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer.spec.js index 9c7d3f0a7b..baab571b30 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/buyer-body/buyer-body.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/type-of-buyer/type-of-buyer.spec.js @@ -1,23 +1,23 @@ import { yesRadio, noRadio } from '../../../../../../pages/shared'; -import buyerBodyPage from '../../../../../../pages/quote/buyerBody'; +import typeOfBuyerPage from '../../../../../../pages/quote/typeOfBuyer'; import { ERROR_MESSAGES, PAGES } from '../../../../../../content-strings'; import { ROUTES, FIELD_IDS, FIELD_VALUES } from '../../../../../../constants'; -const CONTENT_STRINGS = PAGES.QUOTE.BUYER_BODY; +const CONTENT_STRINGS = PAGES.QUOTE.TYPE_OF_BUYER; const { - ELIGIBILITY: { VALID_BUYER_BODY: FIELD_ID }, + ELIGIBILITY: { VALID_TYPE_OF_BUYER: FIELD_ID }, } = FIELD_IDS; const { - QUOTE: { BUYER_BODY, BUYER_COUNTRY, EXPORTER_LOCATION }, + QUOTE: { TYPE_OF_BUYER, BUYER_COUNTRY, EXPORTER_LOCATION }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); -const url = `${baseUrl}${BUYER_BODY}`; +const url = `${baseUrl}${TYPE_OF_BUYER}`; -context('Buyer body page - as an exporter, I want to check if I can get an EXIP online quote for my buyers country', () => { +context('Type of buyer page - as an exporter, I want to check if I can get an EXIP online quote for my buyers country', () => { beforeEach(() => { cy.navigateToRootUrl(); cy.completeAndSubmitBuyerCountryForm({}); @@ -28,7 +28,7 @@ context('Buyer body page - as an exporter, I want to check if I can get an EXIP it('renders core page elements', () => { cy.corePageChecks({ pageTitle: CONTENT_STRINGS.PAGE_TITLE, - currentHref: BUYER_BODY, + currentHref: TYPE_OF_BUYER, backLink: BUYER_COUNTRY, assertAuthenticatedHeader: false, isInsurancePage: false, @@ -53,7 +53,7 @@ context('Buyer body page - as an exporter, I want to check if I can get an EXIP cy.navigateToUrl(url); }); - const { description } = buyerBodyPage; + const { description } = typeOfBuyerPage; it('should render summary text with collapsed conditional `details` content', () => { cy.checkText(description.summary(), CONTENT_STRINGS.DETAILS.INTRO); diff --git a/e2e-tests/switch-between-services/cypress/e2e/journeys/via-exporter-location-routes/get-a-quote-then-complete-insurance-eligibility.spec.js b/e2e-tests/switch-between-services/cypress/e2e/journeys/via-exporter-location-routes/get-a-quote-then-complete-insurance-eligibility.spec.js index 7430ac8cf2..7c1c5e378e 100644 --- a/e2e-tests/switch-between-services/cypress/e2e/journeys/via-exporter-location-routes/get-a-quote-then-complete-insurance-eligibility.spec.js +++ b/e2e-tests/switch-between-services/cypress/e2e/journeys/via-exporter-location-routes/get-a-quote-then-complete-insurance-eligibility.spec.js @@ -1,7 +1,7 @@ import { ROUTES } from '../../../../../constants'; const { - QUOTE: { BUYER_COUNTRY, BUYER_BODY, YOUR_QUOTE }, + QUOTE: { BUYER_COUNTRY, TYPE_OF_BUYER, YOUR_QUOTE }, INSURANCE: { ELIGIBILITY }, } = ROUTES; @@ -36,7 +36,7 @@ context( cy.completeAndSubmitBuyerCountryForm({}); - const expectedUrl = `${baseUrl}${BUYER_BODY}`; + const expectedUrl = `${baseUrl}${TYPE_OF_BUYER}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/switch-between-services/cypress/e2e/journeys/via-start-now-routes/get-a-quote-then-complete-insurance-eligibility.spec.js b/e2e-tests/switch-between-services/cypress/e2e/journeys/via-start-now-routes/get-a-quote-then-complete-insurance-eligibility.spec.js index cc60d61665..0290bda9d3 100644 --- a/e2e-tests/switch-between-services/cypress/e2e/journeys/via-start-now-routes/get-a-quote-then-complete-insurance-eligibility.spec.js +++ b/e2e-tests/switch-between-services/cypress/e2e/journeys/via-start-now-routes/get-a-quote-then-complete-insurance-eligibility.spec.js @@ -2,7 +2,7 @@ import { ROUTES } from '../../../../../constants'; const { ROOT, - QUOTE: { BUYER_BODY, YOUR_QUOTE }, + QUOTE: { TYPE_OF_BUYER, YOUR_QUOTE }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -34,7 +34,7 @@ context('Get a quote, Complete insurance eligibility and then re-visit the quote cy.completeAndSubmitBuyerCountryForm({}); - const expectedUrl = `${baseUrl}${BUYER_BODY}`; + const expectedUrl = `${baseUrl}${TYPE_OF_BUYER}`; cy.assertUrl(expectedUrl); }); diff --git a/src/ui/server/constants/field-ids/index.ts b/src/ui/server/constants/field-ids/index.ts index b80caa4f6e..ccac4212eb 100644 --- a/src/ui/server/constants/field-ids/index.ts +++ b/src/ui/server/constants/field-ids/index.ts @@ -8,7 +8,7 @@ export const FIELD_IDS = { ...SHARED, ELIGIBILITY: { ...SHARED_ELIGIBILITY_FIELD_IDS, - VALID_BUYER_BODY: 'validBuyerBody', + VALID_TYPE_OF_BUYER: 'validBuyerBody', COUNTRY: 'country', AMOUNT_CURRENCY: 'amountAndCurrency', CURRENCY: 'currency', diff --git a/src/ui/server/constants/routes/quote.ts b/src/ui/server/constants/routes/quote.ts index 60c019eb72..5fff726e3a 100644 --- a/src/ui/server/constants/routes/quote.ts +++ b/src/ui/server/constants/routes/quote.ts @@ -4,7 +4,7 @@ export const QUOTE_ROUTES = { // TODO // TODOa // TODO: rename to TYPE_OF_BUYER - BUYER_BODY: '/quote/type-of-buyer', + TYPE_OF_BUYER: '/quote/type-of-buyer', BUYER_COUNTRY: '/quote/buyer-country', BUYER_COUNTRY_CHANGE: '/quote/buyer-country/change', diff --git a/src/ui/server/constants/templates/partials/index.ts b/src/ui/server/constants/templates/partials/index.ts index af48927889..7a2b62caf0 100644 --- a/src/ui/server/constants/templates/partials/index.ts +++ b/src/ui/server/constants/templates/partials/index.ts @@ -55,8 +55,8 @@ export const PARTIALS = { }, }, QUOTE: { - BUYER_BODY: { - CUSTOM_CONTENT_HTML: 'partials/quote/buyer-body-details.njk', + TYPE_OF_BUYER: { + CUSTOM_CONTENT_HTML: 'partials/quote/type-of-buyer-details.njk', }, }, }; diff --git a/src/ui/server/content-strings/error-messages.ts b/src/ui/server/content-strings/error-messages.ts index e8c6af74e7..54e9da4f9d 100644 --- a/src/ui/server/content-strings/error-messages.ts +++ b/src/ui/server/content-strings/error-messages.ts @@ -15,7 +15,7 @@ export const ERROR_MESSAGES = { THERE_IS_A_PROBLEM: 'There is a problem', ELIGIBILITY: { [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY]: 'Select where your buyer is based', - [FIELD_IDS.ELIGIBILITY.VALID_BUYER_BODY]: 'Select if your buyer is a government or public sector body', + [FIELD_IDS.ELIGIBILITY.VALID_TYPE_OF_BUYER]: 'Select if your buyer is a government or public sector body', [FIELD_IDS.ELIGIBILITY.VALID_EXPORTER_LOCATION]: "Select whether you're exporting from a business base in the UK, Channel Islands, Isle of Man or not", [FIELD_IDS.ELIGIBILITY.HAS_MINIMUM_UK_GOODS_OR_SERVICES]: { IS_EMPTY: 'Select whether at least 20% of your export contract value is made up from UK goods or services or not', diff --git a/src/ui/server/content-strings/pages/quote.ts b/src/ui/server/content-strings/pages/quote.ts index 6c29abbe5b..8267785695 100644 --- a/src/ui/server/content-strings/pages/quote.ts +++ b/src/ui/server/content-strings/pages/quote.ts @@ -1,6 +1,6 @@ import { LINKS } from '../links'; -const BUYER_BODY = { +const TYPE_OF_BUYER = { PAGE_TITLE: 'Is your buyer a government or public sector body?', DETAILS: { INTRO: 'What counts as a government or public sector body?', @@ -28,8 +28,8 @@ const CHECK_YOUR_ANSWERS = { const GET_A_QUOTE_BY_EMAIL = { PAGE_TITLE: 'You need to get a quote by email', REASON: { - BUYER_BODY: 'We cannot give you a quote online because your buyer is a government or public sector body.', - BUYER_BODY_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', + TYPE_OF_BUYER: 'We cannot give you a quote online because your buyer is a government or public sector body.', + TYPE_OF_BUYER_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', BUYER_COUNTRY: 'We cannot give you a quote online because of the country where your buyer is based.', BUYER_COUNTRY_DESCRIPTION: "We can still give you a quote but may need extra information from you to assess the risks around your buyer's country first.", }, @@ -97,7 +97,7 @@ const YOUR_QUOTE = { }; export default { - BUYER_BODY, + TYPE_OF_BUYER, POLICY_TYPE, TELL_US_ABOUT_YOUR_POLICY, CHECK_YOUR_ANSWERS, diff --git a/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts b/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts index ad5ecb66b5..3ac450ecb1 100644 --- a/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts +++ b/src/ui/server/controllers/quote/buyer-country/country-redirects.test.ts @@ -80,10 +80,10 @@ describe('controllers/quote/buyer-country - redirects', () => { expect(req.session.submittedData.quoteEligibility).toEqual(expected); }); - it(`should redirect to ${ROUTES.QUOTE.BUYER_BODY}`, async () => { + it(`should redirect to ${ROUTES.QUOTE.TYPE_OF_BUYER}`, async () => { await post(req, res); - expect(res.redirect).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_BODY); + expect(res.redirect).toHaveBeenCalledWith(ROUTES.QUOTE.TYPE_OF_BUYER); }); describe("when the url's last substring is `change`", () => { diff --git a/src/ui/server/controllers/quote/buyer-country/index.ts b/src/ui/server/controllers/quote/buyer-country/index.ts index 7b920be95b..6d5a78954c 100644 --- a/src/ui/server/controllers/quote/buyer-country/index.ts +++ b/src/ui/server/controllers/quote/buyer-country/index.ts @@ -136,7 +136,7 @@ export const post = async (req: Request, res: Response) => { return res.redirect(ROUTES.QUOTE.CHECK_YOUR_ANSWERS); } - return res.redirect(ROUTES.QUOTE.BUYER_BODY); + return res.redirect(ROUTES.QUOTE.TYPE_OF_BUYER); } /** diff --git a/src/ui/server/controllers/quote/buyer-body/index.test.ts b/src/ui/server/controllers/quote/type-of-buyer/index.test.ts similarity index 93% rename from src/ui/server/controllers/quote/buyer-body/index.test.ts rename to src/ui/server/controllers/quote/type-of-buyer/index.test.ts index 4c0a741a99..1873771abe 100644 --- a/src/ui/server/controllers/quote/buyer-body/index.test.ts +++ b/src/ui/server/controllers/quote/type-of-buyer/index.test.ts @@ -12,11 +12,11 @@ import { Request, Response } from '../../../../types'; const { SHARED_PAGES, PARTIALS: { - QUOTE: { BUYER_BODY }, + QUOTE: { TYPE_OF_BUYER }, }, } = TEMPLATES; -describe('controllers/quote/buyer-body', () => { +describe('controllers/quote/type-of-buyer', () => { let req: Request; let res: Response; @@ -35,7 +35,7 @@ describe('controllers/quote/buyer-body', () => { describe('FIELD_ID', () => { it('should have the correct ID', () => { - const expected = FIELD_IDS.ELIGIBILITY.VALID_BUYER_BODY; + const expected = FIELD_IDS.ELIGIBILITY.VALID_TYPE_OF_BUYER; expect(FIELD_ID).toEqual(expected); }); @@ -45,7 +45,7 @@ describe('controllers/quote/buyer-body', () => { it('should have correct properties', () => { const expected = { FIELD_ID: PAGE_VARIABLES.FIELD_ID, - PAGE_CONTENT_STRINGS: PAGES.QUOTE.BUYER_BODY, + PAGE_CONTENT_STRINGS: PAGES.QUOTE.TYPE_OF_BUYER, }; expect(PAGE_VARIABLES).toEqual(expected); @@ -55,7 +55,7 @@ describe('controllers/quote/buyer-body', () => { describe('HTML_FLAGS', () => { it('should have correct properties', () => { const expected = { - CUSTOM_CONTENT_HTML: BUYER_BODY.CUSTOM_CONTENT_HTML, + CUSTOM_CONTENT_HTML: TYPE_OF_BUYER.CUSTOM_CONTENT_HTML, }; expect(HTML_FLAGS).toEqual(expected); @@ -154,13 +154,13 @@ describe('controllers/quote/buyer-body', () => { expect(mockFlash).toHaveBeenCalledTimes(3); - expect(mockFlash.mock.calls[0]).toEqual(['previousRoute', ROUTES.QUOTE.BUYER_BODY]); + expect(mockFlash.mock.calls[0]).toEqual(['previousRoute', ROUTES.QUOTE.TYPE_OF_BUYER]); const { GET_A_QUOTE_BY_EMAIL } = PAGES.QUOTE; const { REASON } = GET_A_QUOTE_BY_EMAIL; - expect(mockFlash.mock.calls[1]).toEqual(['exitReason', REASON.BUYER_BODY]); - expect(mockFlash.mock.calls[2]).toEqual(['exitDescription', REASON.BUYER_BODY_DESCRIPTION]); + expect(mockFlash.mock.calls[1]).toEqual(['exitReason', REASON.TYPE_OF_BUYER]); + expect(mockFlash.mock.calls[2]).toEqual(['exitDescription', REASON.TYPE_OF_BUYER_DESCRIPTION]); }); it(`should redirect to ${ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL}`, async () => { @@ -179,7 +179,7 @@ describe('controllers/quote/buyer-body', () => { req.body = validBody; }); - it('should update the session with submitted data, populated with mapped buyer body answer', async () => { + it('should update the session with submitted data, populated with mapped type of buyer answer', async () => { await post(req, res); const payload = constructPayload(req.body, [FIELD_ID]); diff --git a/src/ui/server/controllers/quote/buyer-body/index.ts b/src/ui/server/controllers/quote/type-of-buyer/index.ts similarity index 80% rename from src/ui/server/controllers/quote/buyer-body/index.ts rename to src/ui/server/controllers/quote/type-of-buyer/index.ts index b99992d319..1209b3a70f 100644 --- a/src/ui/server/controllers/quote/buyer-body/index.ts +++ b/src/ui/server/controllers/quote/type-of-buyer/index.ts @@ -10,15 +10,15 @@ import { Request, Response } from '../../../../types'; const { SHARED_PAGES, PARTIALS: { - QUOTE: { BUYER_BODY }, + QUOTE: { TYPE_OF_BUYER }, }, } = TEMPLATES; -export const FIELD_ID = FIELD_IDS.ELIGIBILITY.VALID_BUYER_BODY; +export const FIELD_ID = FIELD_IDS.ELIGIBILITY.VALID_TYPE_OF_BUYER; export const PAGE_VARIABLES = { FIELD_ID, - PAGE_CONTENT_STRINGS: PAGES.QUOTE.BUYER_BODY, + PAGE_CONTENT_STRINGS: PAGES.QUOTE.TYPE_OF_BUYER, }; /** @@ -26,7 +26,7 @@ export const PAGE_VARIABLES = { * Conditional flags for the nunjucks template to match design */ export const HTML_FLAGS = { - CUSTOM_CONTENT_HTML: BUYER_BODY.CUSTOM_CONTENT_HTML, + CUSTOM_CONTENT_HTML: TYPE_OF_BUYER.CUSTOM_CONTENT_HTML, }; export const TEMPLATE = SHARED_PAGES.SINGLE_RADIO; @@ -35,8 +35,8 @@ export const TEMPLATE = SHARED_PAGES.SINGLE_RADIO; * mapAnswer * Map yes/no answer to true/false boolean. * The saved field ID includes 'valid' so we need to reverse the answer to save it correctly. - * If the answer is 'false', the 'buyer body' is valid. Return true. - * If the answer is 'true', the 'buyer body' is invalid. Return false. + * If the answer is 'false', the 'type of buyer' is valid. Return true. + * If the answer is 'true', the 'type of buyer' is invalid. Return false. * @returns {boolean} */ export const mapAnswer = (answer: string) => { @@ -51,8 +51,8 @@ export const mapAnswer = (answer: string) => { * mapSubmittedAnswer * Map yes/no answer to true/false boolean. * The saved field ID includes 'valid' so we need to reverse the answer in order to render correctly. - * If the answer is 'false', the 'buyer body' is valid and saved as true. Return false. - * If the answer is 'true', the 'buyer body' is invalid and saved as false. Return true. + * If the answer is 'false', the 'type of buyer' is valid and saved as true. Return false. + * If the answer is 'true', the 'type of buyer' is invalid and saved as false. Return true. * @returns {boolean} */ export const mapSubmittedAnswer = (answer?: boolean) => { @@ -100,13 +100,13 @@ export const post = (req: Request, res: Response) => { req.session.submittedData.quoteEligibility = updateSubmittedData({ [FIELD_ID]: mappedAnswer }, req.session.submittedData.quoteEligibility); if (answer === 'true') { - req.flash('previousRoute', ROUTES.QUOTE.BUYER_BODY); + req.flash('previousRoute', ROUTES.QUOTE.TYPE_OF_BUYER); const { GET_A_QUOTE_BY_EMAIL } = PAGES.QUOTE; const { REASON } = GET_A_QUOTE_BY_EMAIL; - req.flash('exitReason', REASON.BUYER_BODY); - req.flash('exitDescription', REASON.BUYER_BODY_DESCRIPTION); + req.flash('exitReason', REASON.TYPE_OF_BUYER); + req.flash('exitDescription', REASON.TYPE_OF_BUYER_DESCRIPTION); return res.redirect(ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL); } diff --git a/src/ui/server/middleware/required-data-provided/quote/index.test.ts b/src/ui/server/middleware/required-data-provided/quote/index.test.ts index 89b82f0a88..3a7737d53c 100644 --- a/src/ui/server/middleware/required-data-provided/quote/index.test.ts +++ b/src/ui/server/middleware/required-data-provided/quote/index.test.ts @@ -4,7 +4,7 @@ import { mockReq, mockRes, mockSession } from '../../../test-mocks'; import { Request, Response } from '../../../../types'; const { - BUYER_BODY, + TYPE_OF_BUYER, BUYER_COUNTRY, BUYER_COUNTRY_CHANGE, CHECK_YOUR_ANSWERS, @@ -26,7 +26,7 @@ const { const { ELIGIBILITY: { - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, CURRENCY, @@ -55,20 +55,20 @@ describe('middleware/required-data-provided/quote', () => { const expected = { [BUYER_COUNTRY]: [], - [BUYER_BODY]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY], - [EXPORTER_LOCATION]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY], - [UK_GOODS_OR_SERVICES]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY, VALID_EXPORTER_LOCATION], - [POLICY_TYPE]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES], + [TYPE_OF_BUYER]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY], + [EXPORTER_LOCATION]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER], + [UK_GOODS_OR_SERVICES]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION], + [POLICY_TYPE]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES], [TELL_US_ABOUT_YOUR_POLICY]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, ], [CHECK_YOUR_ANSWERS]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, @@ -79,7 +79,7 @@ describe('middleware/required-data-provided/quote', () => { ], [YOUR_QUOTE]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, @@ -107,20 +107,20 @@ describe('middleware/required-data-provided/quote', () => { const expected = { [BUYER_COUNTRY]: [], - [BUYER_BODY]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY], - [EXPORTER_LOCATION]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY], - [UK_GOODS_OR_SERVICES]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY, VALID_EXPORTER_LOCATION], - [POLICY_TYPE]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_BUYER_BODY, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES], + [TYPE_OF_BUYER]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY], + [EXPORTER_LOCATION]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER], + [UK_GOODS_OR_SERVICES]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION], + [POLICY_TYPE]: [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES], [TELL_US_ABOUT_YOUR_POLICY]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, ], [CHECK_YOUR_ANSWERS]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, @@ -132,7 +132,7 @@ describe('middleware/required-data-provided/quote', () => { ], [YOUR_QUOTE]: [ FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY, - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, FIELD_IDS.POLICY_TYPE, @@ -156,7 +156,7 @@ describe('middleware/required-data-provided/quote', () => { const expected = { [BUYER_COUNTRY]: allRequiredData({})[BUYER_COUNTRY], [BUYER_COUNTRY_CHANGE]: allRequiredData({})[BUYER_COUNTRY], - [BUYER_BODY]: allRequiredData({})[BUYER_BODY], + [TYPE_OF_BUYER]: allRequiredData({})[TYPE_OF_BUYER], [EXPORTER_LOCATION]: allRequiredData({})[EXPORTER_LOCATION], [EXPORTER_LOCATION_CHANGE]: allRequiredData({})[EXPORTER_LOCATION], [UK_GOODS_OR_SERVICES]: allRequiredData({})[UK_GOODS_OR_SERVICES], diff --git a/src/ui/server/middleware/required-data-provided/quote/index.ts b/src/ui/server/middleware/required-data-provided/quote/index.ts index 218d1d572a..b3f59a685e 100644 --- a/src/ui/server/middleware/required-data-provided/quote/index.ts +++ b/src/ui/server/middleware/required-data-provided/quote/index.ts @@ -5,7 +5,7 @@ import { isSinglePolicyType, isMultiplePolicyType } from '../../../helpers/polic const { START, - BUYER_BODY, + TYPE_OF_BUYER, BUYER_COUNTRY, BUYER_COUNTRY_CHANGE, CANNOT_APPLY_EXIT, @@ -26,7 +26,7 @@ const { const { ELIGIBILITY: { - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, HAS_MINIMUM_UK_GOODS_OR_SERVICES, CURRENCY, @@ -49,9 +49,9 @@ export const allRequiredData = (submittedData: SubmittedDataQuoteEligibility): R requiredDataState[BUYER_COUNTRY] = []; - requiredDataState[BUYER_BODY] = [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY]; + requiredDataState[TYPE_OF_BUYER] = [FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY]; - requiredDataState[EXPORTER_LOCATION] = [...requiredDataState[BUYER_BODY], VALID_BUYER_BODY]; + requiredDataState[EXPORTER_LOCATION] = [...requiredDataState[TYPE_OF_BUYER], VALID_TYPE_OF_BUYER]; requiredDataState[UK_GOODS_OR_SERVICES] = [...requiredDataState[EXPORTER_LOCATION], VALID_EXPORTER_LOCATION]; @@ -85,7 +85,7 @@ export const generateRequiredDataState = (submittedData: SubmittedDataQuoteEligi requiredDataState[BUYER_COUNTRY] = required[BUYER_COUNTRY]; requiredDataState[BUYER_COUNTRY_CHANGE] = required[BUYER_COUNTRY]; - requiredDataState[BUYER_BODY] = required[BUYER_BODY]; + requiredDataState[TYPE_OF_BUYER] = required[TYPE_OF_BUYER]; requiredDataState[EXPORTER_LOCATION] = required[EXPORTER_LOCATION]; requiredDataState[EXPORTER_LOCATION_CHANGE] = required[EXPORTER_LOCATION]; requiredDataState[UK_GOODS_OR_SERVICES] = required[UK_GOODS_OR_SERVICES]; diff --git a/src/ui/server/routes/quote/index.test.ts b/src/ui/server/routes/quote/index.test.ts index e29a17468c..5a8829b259 100644 --- a/src/ui/server/routes/quote/index.test.ts +++ b/src/ui/server/routes/quote/index.test.ts @@ -1,7 +1,7 @@ import { get, post } from '../../test-mocks/mock-router'; import { ROUTES } from '../../constants'; import { get as buyerCountryGet, post as buyerCountryPost } from '../../controllers/quote/buyer-country'; -import { get as buyerBodyGet, post as buyerBodyPost } from '../../controllers/quote/buyer-body'; +import { get as typeOfBuyerGet, post as typeOfBuyerPost } from '../../controllers/quote/type-of-buyer'; import { get as companyBasedGet, post as companyBasedPost } from '../../controllers/quote/exporter-location'; import { get as ukGoodsOrServicesGet, post as ukGoodsOrServicesPost } from '../../controllers/quote/uk-goods-or-services'; import { get as policyTypeGet, post as policyTypePost } from '../../controllers/quote/policy-type'; @@ -31,8 +31,8 @@ describe('routes/quote', () => { expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_COUNTRY_CHANGE, buyerCountryGet); expect(post).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_COUNTRY_CHANGE, buyerCountryPost); - expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_BODY, buyerBodyGet); - expect(post).toHaveBeenCalledWith(ROUTES.QUOTE.BUYER_BODY, buyerBodyPost); + expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.TYPE_OF_BUYER, typeOfBuyerGet); + expect(post).toHaveBeenCalledWith(ROUTES.QUOTE.TYPE_OF_BUYER, typeOfBuyerPost); expect(get).toHaveBeenCalledWith(ROUTES.QUOTE.EXPORTER_LOCATION, companyBasedGet); expect(post).toHaveBeenCalledWith(ROUTES.QUOTE.EXPORTER_LOCATION, companyBasedPost); diff --git a/src/ui/server/routes/quote/index.ts b/src/ui/server/routes/quote/index.ts index 9d085a18fe..45b9103c17 100644 --- a/src/ui/server/routes/quote/index.ts +++ b/src/ui/server/routes/quote/index.ts @@ -1,7 +1,7 @@ import express from 'express'; import { ROUTES } from '../../constants'; import { get as buyerCountryGet, post as buyerCountryPost } from '../../controllers/quote/buyer-country'; -import { get as buyerBodyGet, post as buyerBodyPost } from '../../controllers/quote/buyer-body'; +import { get as typeOfBuyerGet, post as typeOfBuyerPost } from '../../controllers/quote/type-of-buyer'; import { get as companyBasedGet, post as companyBasedPost } from '../../controllers/quote/exporter-location'; import { get as ukGoodsOrServicesGet, post as ukGoodsOrServicesPost } from '../../controllers/quote/uk-goods-or-services'; import { get as policyTypeGet, post as policyTypePost } from '../../controllers/quote/policy-type'; @@ -21,8 +21,8 @@ quoteRouter.post(ROUTES.QUOTE.BUYER_COUNTRY, buyerCountryPost); quoteRouter.get(ROUTES.QUOTE.BUYER_COUNTRY_CHANGE, buyerCountryGet); quoteRouter.post(ROUTES.QUOTE.BUYER_COUNTRY_CHANGE, buyerCountryPost); -quoteRouter.get(ROUTES.QUOTE.BUYER_BODY, buyerBodyGet); -quoteRouter.post(ROUTES.QUOTE.BUYER_BODY, buyerBodyPost); +quoteRouter.get(ROUTES.QUOTE.TYPE_OF_BUYER, typeOfBuyerGet); +quoteRouter.post(ROUTES.QUOTE.TYPE_OF_BUYER, typeOfBuyerPost); quoteRouter.get(ROUTES.QUOTE.EXPORTER_LOCATION, companyBasedGet); quoteRouter.post(ROUTES.QUOTE.EXPORTER_LOCATION, companyBasedPost); diff --git a/src/ui/server/test-mocks/mock-answers.ts b/src/ui/server/test-mocks/mock-answers.ts index 57ca6933a3..6d66fac9d8 100644 --- a/src/ui/server/test-mocks/mock-answers.ts +++ b/src/ui/server/test-mocks/mock-answers.ts @@ -3,7 +3,7 @@ import { SubmittedDataQuoteEligibility } from '../../types'; const { ELIGIBILITY: { - VALID_BUYER_BODY, + VALID_TYPE_OF_BUYER, VALID_EXPORTER_LOCATION, BUYER_COUNTRY, HAS_MINIMUM_UK_GOODS_OR_SERVICES, @@ -17,7 +17,7 @@ const { } = FIELD_IDS; const mockAnswers = { - [VALID_BUYER_BODY]: true, + [VALID_TYPE_OF_BUYER]: true, [VALID_EXPORTER_LOCATION]: true, [BUYER_COUNTRY]: 'Algeria', [HAS_MINIMUM_UK_GOODS_OR_SERVICES]: true, diff --git a/src/ui/templates/partials/quote/buyer-body-details.njk b/src/ui/templates/partials/quote/type-of-buyer-details.njk similarity index 91% rename from src/ui/templates/partials/quote/buyer-body-details.njk rename to src/ui/templates/partials/quote/type-of-buyer-details.njk index 410cb198b0..369a8dd338 100644 --- a/src/ui/templates/partials/quote/buyer-body-details.njk +++ b/src/ui/templates/partials/quote/type-of-buyer-details.njk @@ -10,9 +10,9 @@ summaryText: CONTENT_STRINGS.DETAILS.INTRO, html: detailsHtml, attributes: { - "data-cy": "buyer-body" + "data-cy": "type-of-buyer" } }) }} - \ No newline at end of file + diff --git a/src/ui/types/required-data-state/quote-eligibility.ts b/src/ui/types/required-data-state/quote-eligibility.ts index 893d073bff..0e11eaa64c 100644 --- a/src/ui/types/required-data-state/quote-eligibility.ts +++ b/src/ui/types/required-data-state/quote-eligibility.ts @@ -1,7 +1,7 @@ type RequiredDataStateQuoteEligibility = { 'buyer-country': Array; 'buyer-country/change': Array; - 'buyer-body': Array; + 'type-of-buyer': Array; 'exporter-location': Array; 'exporter-location/change': Array; 'uk-goods-services': Array; From 5706e31630c0b315b2f7232b836b7389fbacbfab Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 12:45:54 +0000 Subject: [PATCH 3/6] fix(EMS-4100): fix typo --- e2e-tests/constants/routes/insurance/index.js | 2 +- e2e-tests/constants/routes/quote.js | 4 +++- e2e-tests/content-strings/pages/index.js | 4 ++-- .../navigate-to-buyer-country-page-directly.spec.js | 4 ++-- ...vigate-to-companies-house-number-page-directly.spec.js | 4 ++-- .../navigate-to-cover-period-page-directly.spec.js | 4 ++-- ...gate-to-eligible-to-apply-online-page-directly.spec.js | 6 +++--- .../navigate-to-total-value-insured-page-directly.spec.js | 4 ++-- ...navigate-to-uk-goods-or-services-page-directly.spec.js | 4 ++-- ...-already-signed-in-with-no-eligibility-answers.spec.js | 6 +++--- .../e2e/journeys/eligibility/need-to-start-again.spec.js | 8 ++++---- .../navigate-to-check-answers-page-directly.spec.js | 4 ++-- .../navigate-to-exporter-location-page-directly.spec.js | 6 +++--- .../navigate-to-kind-of-policy-page-directly.spec.js | 4 ++-- .../navigate-to-quote-page-directly.spec.js | 4 ++-- ...ate-to-tell-us-about-your-policy-page-directly.spec.js | 4 ++-- .../navigate-to-type-of-buyer-page-directly.spec.js | 4 ++-- ...navigate-to-uk-goods-or-services-page-directly.spec.js | 4 ++-- .../e2e/journeys/quote/need-to-start-again.spec.js | 8 ++++---- src/ui/server/constants/routes/quote.ts | 3 --- 20 files changed, 45 insertions(+), 46 deletions(-) diff --git a/e2e-tests/constants/routes/insurance/index.js b/e2e-tests/constants/routes/insurance/index.js index 9a49c9e9fc..1df8e8ec47 100644 --- a/e2e-tests/constants/routes/insurance/index.js +++ b/e2e-tests/constants/routes/insurance/index.js @@ -47,7 +47,7 @@ export const INSURANCE_ROUTES = { CHECK_YOUR_ANSWERS: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/check-your-answers`, ELIGIBLE_TO_APPLY_ONLINE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/eligible-to-apply-online`, HAVE_AN_ACCOUNT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/do-you-have-an-account`, - NEED_TO_START_AGAIN: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/need-to-start-again`, + NEED_TO_START_AGAIN_EXIT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/need-to-start-again`, TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/talk-to-an-export-finance-manager`, PARTY_TO_CONSORTIUM: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium`, PARTY_TO_CONSORTIUM_CHANGE: `${INSURANCE_ROOT}${ELIGIBILITY_ROOT}/party-to-any-consortium/change`, diff --git a/e2e-tests/constants/routes/quote.js b/e2e-tests/constants/routes/quote.js index aed4c55a15..cbc89dcd26 100644 --- a/e2e-tests/constants/routes/quote.js +++ b/e2e-tests/constants/routes/quote.js @@ -24,9 +24,11 @@ export const QUOTE_ROUTES = { CANNOT_APPLY_EXIT: '/quote/cannot-apply', + GET_A_QUOTE_BY_EMAIL: '/quote/get-quote-by-email', + TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT: '/quote/talk-to-an-export-finance-manager', YOUR_QUOTE: '/quote/your-quote', - NEED_TO_START_AGAIN: '/quote/need-to-start-again', + NEED_TO_START_AGAIN_EXIT: '/quote/need-to-start-again', }; diff --git a/e2e-tests/content-strings/pages/index.js b/e2e-tests/content-strings/pages/index.js index ab501d19b3..91040c8e43 100644 --- a/e2e-tests/content-strings/pages/index.js +++ b/e2e-tests/content-strings/pages/index.js @@ -178,7 +178,7 @@ const COOKIES_SAVED_PAGE = { BODY: 'You can change your preferences at any time.', }; -const NEED_TO_START_AGAIN_EXIT = { +const NEED_TO_START_AGAIN_EXIT_EXIT = { PAGE_TITLE: 'You need to start again', REASON: 'This is because you have not yet answered all the eligibility questions.', }; @@ -235,7 +235,7 @@ const PAGES = { ACCESSIBILITY_STATEMENT_PAGE, COOKIES_PAGE, COOKIES_SAVED_PAGE, - NEED_TO_START_AGAIN_EXIT, + NEED_TO_START_AGAIN_EXIT_EXIT, PAGE_NOT_FOUND_PAGE, PROBLEM_WITH_SERVICE_PAGE, CONTACT_US_PAGE, diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-buyer-country-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-buyer-country-page-directly.spec.js index 51c221b089..3403043749 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-buyer-country-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-buyer-country-page-directly.spec.js @@ -1,7 +1,7 @@ import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; const { - ELIGIBILITY: { BUYER_COUNTRY, NEED_TO_START_AGAIN }, + ELIGIBILITY: { BUYER_COUNTRY, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Buyer country` page via URL without completing t }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-companies-house-number-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-companies-house-number-page-directly.spec.js index 7abe207a74..85b703ba49 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-companies-house-number-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-companies-house-number-page-directly.spec.js @@ -1,7 +1,7 @@ import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; const { - ELIGIBILITY: { COMPANIES_HOUSE_NUMBER, NEED_TO_START_AGAIN }, + ELIGIBILITY: { COMPANIES_HOUSE_NUMBER, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Companies house number` page via URL without com }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-cover-period-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-cover-period-page-directly.spec.js index 9d79f244b9..e01b321924 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-cover-period-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-cover-period-page-directly.spec.js @@ -2,7 +2,7 @@ import { ROUTES } from '../../../../../../constants'; const { INSURANCE: { - ELIGIBILITY: { COVER_PERIOD, NEED_TO_START_AGAIN }, + ELIGIBILITY: { COVER_PERIOD, NEED_TO_START_AGAIN_EXIT }, }, } = ROUTES; @@ -14,7 +14,7 @@ context('Manually going to the `Cover period` page via URL without completing th }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-eligible-to-apply-online-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-eligible-to-apply-online-page-directly.spec.js index 789c5be740..b40a7648aa 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-eligible-to-apply-online-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-eligible-to-apply-online-page-directly.spec.js @@ -1,7 +1,7 @@ import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; const { - ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN }, + ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -11,8 +11,8 @@ context('Manually going to the `Eligible to apply online` page via URL without c cy.navigateToUrl(ELIGIBLE_TO_APPLY_ONLINE); }); - it(`should redirect to ${NEED_TO_START_AGAIN}`, () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + it(`should redirect to ${NEED_TO_START_AGAIN_EXIT}`, () => { + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-total-value-insured-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-total-value-insured-page-directly.spec.js index 7d94a9d037..8140cc72f5 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-total-value-insured-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-total-value-insured-page-directly.spec.js @@ -2,7 +2,7 @@ import { ROUTES } from '../../../../../../constants'; const { INSURANCE: { - ELIGIBILITY: { TOTAL_VALUE_INSURED, NEED_TO_START_AGAIN }, + ELIGIBILITY: { TOTAL_VALUE_INSURED, NEED_TO_START_AGAIN_EXIT }, }, } = ROUTES; @@ -14,7 +14,7 @@ context('Manually going to the `total value insured` page via URL without comple }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js index 3f028a8fd7..7f40735745 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js @@ -1,7 +1,7 @@ import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; const { - ELIGIBILITY: { UK_GOODS_OR_SERVICES, NEED_TO_START_AGAIN }, + ELIGIBILITY: { UK_GOODS_OR_SERVICES, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `UK goods or services` page via URL without compl }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/eligible-to-apply-online/eligible-to-apply-online-already-signed-in-with-no-eligibility-answers.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/eligible-to-apply-online/eligible-to-apply-online-already-signed-in-with-no-eligibility-answers.spec.js index 47c482857c..51c8031c31 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/eligible-to-apply-online/eligible-to-apply-online-already-signed-in-with-no-eligibility-answers.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/eligible-to-apply-online/eligible-to-apply-online-already-signed-in-with-no-eligibility-answers.spec.js @@ -1,7 +1,7 @@ import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance'; const { - ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN }, + ELIGIBILITY: { ELIGIBLE_TO_APPLY_ONLINE, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -26,8 +26,8 @@ context('Insurance - Eligibility - You are eligible to apply online page - user cy.deleteAccount(); }); - it(`should redirect to ${NEED_TO_START_AGAIN}`, () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + it(`should redirect to ${NEED_TO_START_AGAIN_EXIT}`, () => { + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/need-to-start-again.spec.js b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/need-to-start-again.spec.js index 7c74a6ba5b..25f6342647 100644 --- a/e2e-tests/insurance/cypress/e2e/journeys/eligibility/need-to-start-again.spec.js +++ b/e2e-tests/insurance/cypress/e2e/journeys/eligibility/need-to-start-again.spec.js @@ -2,10 +2,10 @@ import { needToStartAgainPage } from '../../../../../pages/shared'; import { LINKS, PAGES } from '../../../../../content-strings'; import { INSURANCE_ROUTES } from '../../../../../constants/routes/insurance'; -const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT; +const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT_EXIT; const { - ELIGIBILITY: { BUYER_COUNTRY, EXPORTER_LOCATION, NEED_TO_START_AGAIN }, + ELIGIBILITY: { BUYER_COUNTRY, EXPORTER_LOCATION, NEED_TO_START_AGAIN_EXIT }, } = INSURANCE_ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -24,7 +24,7 @@ context('Insurance Eligibility - Need to start again exit page', () => { cy.navigateToUrl(buyerCountryUrl); - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); @@ -32,7 +32,7 @@ context('Insurance Eligibility - Need to start again exit page', () => { it('renders core page elements', () => { cy.corePageChecks({ pageTitle: CONTENT_STRINGS.PAGE_TITLE, - currentHref: NEED_TO_START_AGAIN, + currentHref: NEED_TO_START_AGAIN_EXIT, backLink: BUYER_COUNTRY, assertBackLink: false, submitButtonCopy: LINKS.START_AGAIN.TEXT, diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-check-answers-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-check-answers-page-directly.spec.js index 167ba93a2b..ae1f8fc0c3 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-check-answers-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-check-answers-page-directly.spec.js @@ -1,7 +1,7 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { CHECK_YOUR_ANSWERS, NEED_TO_START_AGAIN }, + QUOTE: { CHECK_YOUR_ANSWERS, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Check your answers` via URL page without complet }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-exporter-location-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-exporter-location-page-directly.spec.js index a58b7b8e96..74a9b7b85e 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-exporter-location-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-exporter-location-page-directly.spec.js @@ -1,7 +1,7 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { EXPORTER_LOCATION, EXPORTER_LOCATION_CHANGE, NEED_TO_START_AGAIN }, + QUOTE: { EXPORTER_LOCATION, EXPORTER_LOCATION_CHANGE, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Exporter location` page via URL without completi }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); @@ -24,7 +24,7 @@ context('Manually going to the `Change Exporter location lo` page via URL withou }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-kind-of-policy-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-kind-of-policy-page-directly.spec.js index ca49d48a54..45cf4b26e5 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-kind-of-policy-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-kind-of-policy-page-directly.spec.js @@ -1,11 +1,11 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { POLICY_TYPE, POLICY_TYPE_CHANGE, NEED_TO_START_AGAIN }, + QUOTE: { POLICY_TYPE, POLICY_TYPE_CHANGE, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); -const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; +const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; context('Manually going to the `Policy type` page via URL without completing the previous forms', () => { beforeEach(() => { diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-quote-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-quote-page-directly.spec.js index 55a7c3a6c7..c29118d246 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-quote-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-quote-page-directly.spec.js @@ -1,7 +1,7 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { YOUR_QUOTE, NEED_TO_START_AGAIN }, + QUOTE: { YOUR_QUOTE, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Your quote` page via URL without completing the }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); }); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-tell-us-about-your-policy-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-tell-us-about-your-policy-page-directly.spec.js index 2fa091907d..8fe57c698e 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-tell-us-about-your-policy-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-tell-us-about-your-policy-page-directly.spec.js @@ -1,11 +1,11 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { TELL_US_ABOUT_YOUR_POLICY, TELL_US_ABOUT_YOUR_POLICY_CHANGE, NEED_TO_START_AGAIN }, + QUOTE: { TELL_US_ABOUT_YOUR_POLICY, TELL_US_ABOUT_YOUR_POLICY_CHANGE, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); -const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; +const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; context('Manually going to the `Tell us about your policy` page via URL without completing previous forms', () => { beforeEach(() => { diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js index 21b533b0d2..92314436ea 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-type-of-buyer-page-directly.spec.js @@ -1,7 +1,7 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { TYPE_OF_BUYER, NEED_TO_START_AGAIN }, + QUOTE: { TYPE_OF_BUYER, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -12,7 +12,7 @@ context('Manually going to the `Type of buyer` via URL page without completing t }); it('should redirect to the `need to start again` exit page', () => { - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js index b713a6cece..9e9ffe39ab 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/cannot-skip-flow/navigate-to-uk-goods-or-services-page-directly.spec.js @@ -1,12 +1,12 @@ import { ROUTES } from '../../../../../../constants'; const { - QUOTE: { UK_GOODS_OR_SERVICES, UK_GOODS_OR_SERVICES_CHANGE, NEED_TO_START_AGAIN }, + QUOTE: { UK_GOODS_OR_SERVICES, UK_GOODS_OR_SERVICES_CHANGE, NEED_TO_START_AGAIN_EXIT }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); -const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; +const needToStartAgainUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; context('Manually going to the `UK goods or services` page via URL without completing the previous forms', () => { beforeEach(() => { diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/need-to-start-again.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/need-to-start-again.spec.js index ddc2742b42..86bb2bac8d 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/need-to-start-again.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/need-to-start-again.spec.js @@ -2,10 +2,10 @@ import { needToStartAgainPage } from '../../../../../pages/shared'; import { LINKS, PAGES } from '../../../../../content-strings'; import { ROUTES } from '../../../../../constants'; -const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT; +const CONTENT_STRINGS = PAGES.NEED_TO_START_AGAIN_EXIT_EXIT; const { - QUOTE: { TELL_US_ABOUT_YOUR_POLICY, NEED_TO_START_AGAIN, BUYER_COUNTRY }, + QUOTE: { TELL_US_ABOUT_YOUR_POLICY, NEED_TO_START_AGAIN_EXIT, BUYER_COUNTRY }, } = ROUTES; const baseUrl = Cypress.config('baseUrl'); @@ -20,7 +20,7 @@ context('Get a Quote - Need to start again exit page', () => { cy.saveSession(); - const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN}`; + const expectedUrl = `${baseUrl}${NEED_TO_START_AGAIN_EXIT}`; cy.assertUrl(expectedUrl); }); @@ -28,7 +28,7 @@ context('Get a Quote - Need to start again exit page', () => { it('renders core page elements', () => { cy.corePageChecks({ pageTitle: CONTENT_STRINGS.PAGE_TITLE, - currentHref: NEED_TO_START_AGAIN, + currentHref: NEED_TO_START_AGAIN_EXIT, submitButtonCopy: LINKS.START_AGAIN.TEXT, assertBackLink: false, assertAuthenticatedHeader: false, diff --git a/src/ui/server/constants/routes/quote.ts b/src/ui/server/constants/routes/quote.ts index 5fff726e3a..f91da16151 100644 --- a/src/ui/server/constants/routes/quote.ts +++ b/src/ui/server/constants/routes/quote.ts @@ -1,9 +1,6 @@ export const QUOTE_ROUTES = { START: '/', - // TODO - // TODOa - // TODO: rename to TYPE_OF_BUYER TYPE_OF_BUYER: '/quote/type-of-buyer', BUYER_COUNTRY: '/quote/buyer-country', From f84df696c484decfa9fd367b221b63e39305270d Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 13:02:10 +0000 Subject: [PATCH 4/6] fix(EMS-4100): fix typo --- .../quote/talk-to-an-export-finance-manager/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts index a241a6be3b..20d3cd51e2 100644 --- a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts +++ b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.test.ts @@ -26,7 +26,7 @@ describe('controllers/quote/talk-to-an-export-finance-manager', () => { it('should render template', () => { get(req, res); - expect(res.render).toHaveBeenCalledWith(TEMPLATES.QUOTE.GET_A_QUOTE_BY_EMAIL, { + expect(res.render).toHaveBeenCalledWith(TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, { ...corePageVariables({ PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, BACK_LINK: req.headers.referer, From 3063da1b676689afcd4795de543d76cd2f233006 Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 13:33:48 +0000 Subject: [PATCH 5/6] fix(EMS-4100): fix/update tests --- e2e-tests/content-strings/pages/quote.js | 2 -- .../quote/get-a-quote-via-email.spec.js | 20 ++++++------------- src/ui/server/content-strings/pages/quote.ts | 2 -- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/e2e-tests/content-strings/pages/quote.js b/e2e-tests/content-strings/pages/quote.js index a1b3b9ac5b..456148110b 100644 --- a/e2e-tests/content-strings/pages/quote.js +++ b/e2e-tests/content-strings/pages/quote.js @@ -59,8 +59,6 @@ const GET_A_QUOTE_BY_EMAIL = { REASON: { TYPE_OF_BUYER: 'We cannot give you a quote online because your buyer is a government or public sector body.', TYPE_OF_BUYER_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', - BUYER_COUNTRY: 'We cannot give you a quote online because of the country where your buyer is based.', - BUYER_COUNTRY_DESCRIPTION: "We can still give you a quote but may need extra information from you to assess the risks around your buyer's country first.", }, ACTION: [ [ diff --git a/e2e-tests/quote/cypress/e2e/journeys/quote/get-a-quote-via-email.spec.js b/e2e-tests/quote/cypress/e2e/journeys/quote/get-a-quote-via-email.spec.js index 7bc0773c6d..2e1fa0ece8 100644 --- a/e2e-tests/quote/cypress/e2e/journeys/quote/get-a-quote-via-email.spec.js +++ b/e2e-tests/quote/cypress/e2e/journeys/quote/get-a-quote-via-email.spec.js @@ -1,26 +1,18 @@ -import { autoCompleteField } from '../../../../../pages/shared'; import { getAQuoteByEmailPage } from '../../../../../pages/quote'; import { PAGES } from '../../../../../content-strings'; -import { ROUTES, FIELD_IDS } from '../../../../../constants'; -import { COUNTRY_QUOTE_SUPPORT } from '../../../../../fixtures/countries'; +import { ROUTES } from '../../../../../constants'; const CONTENT_STRINGS = PAGES.QUOTE.GET_A_QUOTE_BY_EMAIL; -const FIELD_ID = FIELD_IDS.ELIGIBILITY.BUYER_COUNTRY; - -const COUNTRY_NAME_QUOTE_BY_EMAIL_ONLY = COUNTRY_QUOTE_SUPPORT.NO_ONLINE_SUPPORT_1.NAME; - const baseUrl = Cypress.config('baseUrl'); context('Get a quote via email exit page', () => { beforeEach(() => { cy.navigateToRootUrl(); - cy.keyboardInput(autoCompleteField(FIELD_ID).input(), COUNTRY_NAME_QUOTE_BY_EMAIL_ONLY); - - const results = autoCompleteField(FIELD_ID).results(); - results.first().click(); + cy.completeAndSubmitBuyerCountryForm({}); + cy.clickYesRadioInput(); cy.clickSubmitButton(); const expectedUrl = `${baseUrl}${ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL}`; @@ -32,7 +24,7 @@ context('Get a quote via email exit page', () => { cy.corePageChecks({ pageTitle: CONTENT_STRINGS.PAGE_TITLE, currentHref: ROUTES.QUOTE.GET_A_QUOTE_BY_EMAIL, - backLink: ROUTES.QUOTE.BUYER_COUNTRY, + backLink: ROUTES.QUOTE.TYPE_OF_BUYER, hasAForm: false, assertAuthenticatedHeader: false, isInsurancePage: false, @@ -44,9 +36,9 @@ context('Get a quote via email exit page', () => { }); it('renders a reason and description ', () => { - cy.checkText(getAQuoteByEmailPage.reason(), CONTENT_STRINGS.REASON.BUYER_COUNTRY); + cy.checkText(getAQuoteByEmailPage.reason(), CONTENT_STRINGS.REASON.TYPE_OF_BUYER); - cy.checkText(getAQuoteByEmailPage.description(), CONTENT_STRINGS.REASON.BUYER_COUNTRY_DESCRIPTION); + cy.checkText(getAQuoteByEmailPage.description(), CONTENT_STRINGS.REASON.TYPE_OF_BUYER_DESCRIPTION); }); it('renders `action` content', () => { diff --git a/src/ui/server/content-strings/pages/quote.ts b/src/ui/server/content-strings/pages/quote.ts index 8267785695..6da82464a8 100644 --- a/src/ui/server/content-strings/pages/quote.ts +++ b/src/ui/server/content-strings/pages/quote.ts @@ -30,8 +30,6 @@ const GET_A_QUOTE_BY_EMAIL = { REASON: { TYPE_OF_BUYER: 'We cannot give you a quote online because your buyer is a government or public sector body.', TYPE_OF_BUYER_DESCRIPTION: 'We can still give you a quote but may need extra information from you to assess the risks around your buyer first.', - BUYER_COUNTRY: 'We cannot give you a quote online because of the country where your buyer is based.', - BUYER_COUNTRY_DESCRIPTION: "We can still give you a quote but may need extra information from you to assess the risks around your buyer's country first.", }, ACTION: [ [ From b8944514a1fc73fe2ea58fc17e6618e2b927f076 Mon Sep 17 00:00:00 2001 From: ttbarnes Date: Tue, 14 Jan 2025 14:27:28 +0000 Subject: [PATCH 6/6] fix(EMS-4100): fix typo --- .../quote/talk-to-an-export-finance-manager/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts index 7e2d0d5046..4271ae7b1b 100644 --- a/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts +++ b/src/ui/server/controllers/quote/talk-to-an-export-finance-manager/index.ts @@ -13,9 +13,8 @@ export const TEMPLATE = TEMPLATES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT; * @param {Express.Response} Express response * @returns {Express.Response.render} "Talk to an export finance manager" exit page */ -export const get = (req: Request, res: Response) => { +export const get = (req: Request, res: Response) => res.render(TEMPLATE, { ...corePageVariables({ PAGE_CONTENT_STRINGS: PAGES.TALK_TO_AN_EXPORT_FINANCE_MANAGER_EXIT, BACK_LINK: req.headers.referer, ORIGINAL_URL: req.originalUrl }), userName: getUserNameFromSession(req.session.user), }); -};