From 5601fcd495aef09708254c9a912efc6d6e731f15 Mon Sep 17 00:00:00 2001 From: Simon Boyd Date: Thu, 5 Dec 2024 14:22:43 +0000 Subject: [PATCH] Fix companyNumber missing from URL after lang change --- src/routers/handlers/stop-screen/stopScreenHandler.ts | 2 +- test/routers/handlers/stop-screen/stopScreenHandler.unit.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routers/handlers/stop-screen/stopScreenHandler.ts b/src/routers/handlers/stop-screen/stopScreenHandler.ts index 9ad69657..e25e7b08 100644 --- a/src/routers/handlers/stop-screen/stopScreenHandler.ts +++ b/src/routers/handlers/stop-screen/stopScreenHandler.ts @@ -47,7 +47,7 @@ const setContent = async (req: Request, res: Response, stopType: STOP_TYPE, base ...baseViewData, ...getLocaleInfo(locales, lang), templateName: stopType, - currentUrl: resolveUrlTemplate(stopScreenPrefixedUrl, stopType), + currentUrl: addSearchParams(getUrlWithStopType(stopScreenPrefixedUrl, stopType), { companyNumber, lang }), backURL: addSearchParams(resolveUrlTemplate(PrefixedUrls.CONFIRM_COMPANY), { companyNumber }), backLinkDataEvent: "company-type-back-link", extraData: [companyName, resolveUrlTemplate(PrefixedUrls.COMPANY_NUMBER), env.CONTACT_US_LINK] diff --git a/test/routers/handlers/stop-screen/stopScreenHandler.unit.ts b/test/routers/handlers/stop-screen/stopScreenHandler.unit.ts index 74cbdf72..e0d055a1 100644 --- a/test/routers/handlers/stop-screen/stopScreenHandler.unit.ts +++ b/test/routers/handlers/stop-screen/stopScreenHandler.unit.ts @@ -71,6 +71,7 @@ describe("Stop screen handler", () => { expect(viewData).toMatchObject( { ...expectedViewData, + currentUrl: `/persons-with-significant-control-verification/stop/${stopType}?companyNumber=00006400&lang=en`, backURL: `${PrefixedUrls.CONFIRM_COMPANY}?lang=en&companyNumber=00006400`, extraData: [validCompanyProfile.companyName, `${PrefixedUrls.COMPANY_NUMBER}?lang=en`, env.CONTACT_US_LINK] });