From 42a251ce5506a7d3a41db2d97fa30ecd8fcdb8a8 Mon Sep 17 00:00:00 2001 From: hatidev Date: Mon, 9 Dec 2024 16:53:43 +0000 Subject: [PATCH 1/7] lp238 create now you need to tell us about limited partners page --- locales/cy/translations.json | 5 +++++ locales/en/translations.json | 5 +++++ src/config/constants.ts | 1 + .../controller/registration/PageType.ts | 1 + .../controller/registration/Routing.ts | 12 ++++++++++++ src/routes/registration.ts | 7 +++++++ src/views/limited-partners.njk | 19 +++++++++++++++++++ 7 files changed, 50 insertions(+) create mode 100644 src/views/limited-partners.njk diff --git a/locales/cy/translations.json b/locales/cy/translations.json index 96d25eb..9918217 100644 --- a/locales/cy/translations.json +++ b/locales/cy/translations.json @@ -45,6 +45,11 @@ } }, + "limitedPartnersPage": { + "title": "WELSH - You now need to tell us about the general partners", + "pageInformation": "WELSH - If the partnership has more than one general partner, you'll add them one at a time." + }, + "pageNotFound" : { "title" : "WELSH - Page Not Found", "spelling" : "WELSH - If you typed the web address, check it is spelled correctly.", diff --git a/locales/en/translations.json b/locales/en/translations.json index 6a6f2a1..5d7ca4c 100644 --- a/locales/en/translations.json +++ b/locales/en/translations.json @@ -45,6 +45,11 @@ } }, + "limitedPartnersPage": { + "title": "You now need to tell us about the general partners", + "pageInformation": "If the partnership has more than one general partner, you'll add them one at a time." + }, + "pageNotFound" : { "title" : "Page not found", "spelling" : "If you typed the web address, check it is spelled correctly.", diff --git a/src/config/constants.ts b/src/config/constants.ts index b51c2f1..3241cd3 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -39,3 +39,4 @@ export const BASE_URL = "/limited-partnerships"; export const TRANSACTION_ID = ":transactionId"; export const SUBMISSION_ID = ":submissionId"; +export const BASE_WITH_IDS_URL = `${BASE_URL}/transaction/${TRANSACTION_ID}/submission/${SUBMISSION_ID}`; \ No newline at end of file diff --git a/src/presentation/controller/registration/PageType.ts b/src/presentation/controller/registration/PageType.ts index 5005149..e718384 100644 --- a/src/presentation/controller/registration/PageType.ts +++ b/src/presentation/controller/registration/PageType.ts @@ -1,6 +1,7 @@ enum RegistrationPageType { name = "name", whichType = "which-type", + limitedPartners = "limited-partners", next = "next", } diff --git a/src/presentation/controller/registration/Routing.ts b/src/presentation/controller/registration/Routing.ts index aed4d46..f4223c2 100644 --- a/src/presentation/controller/registration/Routing.ts +++ b/src/presentation/controller/registration/Routing.ts @@ -1,6 +1,7 @@ import { PageRouting, PagesRouting } from "../PageRouting"; import { BASE_URL, + BASE_WITH_IDS_URL, SUBMISSION_ID, TRANSACTION_ID, } from "../../../config/constants"; @@ -12,12 +13,15 @@ const START_URL = `${BASE_URL}/start`; export const WHICH_TYPE_TEMPLATE = RegistrationPageType.whichType; export const NAME_TEMPLATE = RegistrationPageType.name; export const NEXT_TEMPLATE = RegistrationPageType.next; +export const LIMITED_PARTNERS_TEMPLATE = RegistrationPageType.limitedPartners; export const WHICH_TYPE_URL = `${BASE_URL}/${WHICH_TYPE_TEMPLATE}`; export const NAME_URL = `${BASE_URL}/${NAME_TEMPLATE}`; export const NEXT_URL = `${BASE_URL}/transaction/${TRANSACTION_ID}/submission/${SUBMISSION_ID}/${NEXT_TEMPLATE}`; +export const LIMITED_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${LIMITED_PARTNERS_TEMPLATE}`; + const registrationRoutingPartnershipType = { previousUrl: START_URL, currentUrl: WHICH_TYPE_URL, @@ -32,6 +36,13 @@ export const registrationRoutingName = { pageType: RegistrationPageType.name, }; +const registrationRoutingLimitedPartners = { + previousUrl: WHICH_TYPE_URL, + currentUrl: LIMITED_PARTNERS_URL, + nextUrl: NEXT_URL, + pageType: RegistrationPageType.limitedPartners, +}; + const registrationRoutingNext = { previousUrl: WHICH_TYPE_URL, currentUrl: NEXT_URL, @@ -43,6 +54,7 @@ const list = [ registrationRoutingPartnershipType, registrationRoutingName, registrationRoutingNext, + registrationRoutingLimitedPartners, ]; export const registrationsRouting: PagesRouting = new Map< diff --git a/src/routes/registration.ts b/src/routes/registration.ts index d690317..61a9c68 100644 --- a/src/routes/registration.ts +++ b/src/routes/registration.ts @@ -8,6 +8,7 @@ import { NAME_URL, NEXT_URL, WHICH_TYPE_URL, + LIMITED_PARTNERS_URL, } from "../presentation/controller/registration/Routing"; export const registrationEndpoints = ( @@ -41,6 +42,12 @@ export const registrationEndpoints = ( authentication, dependencies.registrationController.getPageRouting() ); + + router.get( + LIMITED_PARTNERS_URL, + authentication, + dependencies.registrationController.getPageRouting() + ); }; export default registrationEndpoints; diff --git a/src/views/limited-partners.njk b/src/views/limited-partners.njk new file mode 100644 index 0000000..93dd4a6 --- /dev/null +++ b/src/views/limited-partners.njk @@ -0,0 +1,19 @@ +{% extends "layout.njk" %} + +{% block beforeContent %} + {% include "includes/back-link.njk" %} +{% endblock %} + +{% block content %} +
+
+ +

{{ i18n.limitedPartnersPage.title }}

+ +

{{ i18n.limitedPartnersPage.pageInformation }}

+ + + +
+
+{% endblock %} \ No newline at end of file From e17c94efb5d330d50e504d3ce71c47a003cb11d0 Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 09:27:08 +0000 Subject: [PATCH 2/7] remove redudant text --- src/presentation/controller/registration/Routing.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/presentation/controller/registration/Routing.ts b/src/presentation/controller/registration/Routing.ts index e96683c..ddf26f8 100644 --- a/src/presentation/controller/registration/Routing.ts +++ b/src/presentation/controller/registration/Routing.ts @@ -2,8 +2,6 @@ import { PageRouting, PagesRouting } from "../PageRouting"; import { BASE_URL, BASE_WITH_IDS_URL, - SUBMISSION_ID, - TRANSACTION_ID, } from "../../../config/constants"; import RegistrationPageType from "./PageType"; From 6c22e6f21c2c438c17a801d6a173a88c5a094665 Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 11:04:30 +0000 Subject: [PATCH 3/7] resolve review comments --- .../controller/registration/PageType.ts | 2 +- .../controller/registration/Routing.ts | 21 ++++++++++--------- src/routes/registration.ts | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/presentation/controller/registration/PageType.ts b/src/presentation/controller/registration/PageType.ts index a02d032..f3cd0ba 100644 --- a/src/presentation/controller/registration/PageType.ts +++ b/src/presentation/controller/registration/PageType.ts @@ -1,9 +1,9 @@ enum RegistrationPageType { whichType = "which-type", + name = "name", email = "email", generalPartners = "general-partners", limitedPartners = "limited-partners", - name = "name", next = "next", } diff --git a/src/presentation/controller/registration/Routing.ts b/src/presentation/controller/registration/Routing.ts index ddf26f8..a7b0440 100644 --- a/src/presentation/controller/registration/Routing.ts +++ b/src/presentation/controller/registration/Routing.ts @@ -12,9 +12,9 @@ export const WHICH_TYPE_TEMPLATE = RegistrationPageType.whichType; export const NAME_TEMPLATE = RegistrationPageType.name; export const EMAIL_TEMPLATE = RegistrationPageType.email; export const GENERAL_PARTNERS_TEMPLATE = RegistrationPageType.generalPartners; +export const LIMITED_PARTNERS_TEMPLATE = RegistrationPageType.limitedPartners; export const NEXT_TEMPLATE = RegistrationPageType.next; -export const LIMITED_PARTNERS_TEMPLATE = RegistrationPageType.limitedPartners; export const WHICH_TYPE_URL = `${BASE_URL}/${WHICH_TYPE_TEMPLATE}`; export const NAME_URL = `${BASE_URL}/${NAME_TEMPLATE}`; @@ -22,9 +22,10 @@ export const EMAIL_URL = `${BASE_WITH_IDS_URL}/${EMAIL_TEMPLATE}`; export const GENERAL_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${GENERAL_PARTNERS_TEMPLATE}`; +export const LIMITED_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${LIMITED_PARTNERS_TEMPLATE}`; + export const NEXT_URL = `${BASE_WITH_IDS_URL}/${NEXT_TEMPLATE}`; -export const LIMITED_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${LIMITED_PARTNERS_TEMPLATE}`; const registrationRoutingPartnershipType = { previousUrl: START_URL, @@ -40,13 +41,6 @@ const registrationRoutingName = { pageType: RegistrationPageType.name, }; -const registrationRoutingLimitedPartners = { - previousUrl: WHICH_TYPE_URL, - currentUrl: LIMITED_PARTNERS_URL, - nextUrl: NEXT_URL, - pageType: RegistrationPageType.limitedPartners, -}; - const registrationRoutingEmail = { previousUrl: WHICH_TYPE_URL, currentUrl: EMAIL_URL, @@ -61,6 +55,13 @@ const registrationRoutingGeneralPartners = { pageType: RegistrationPageType.generalPartners, }; +const registrationRoutingLimitedPartners = { + previousUrl: WHICH_TYPE_URL, + currentUrl: LIMITED_PARTNERS_URL, + nextUrl: NEXT_URL, + pageType: RegistrationPageType.limitedPartners, +}; + const registrationRoutingNext = { previousUrl: GENERAL_PARTNERS_URL, currentUrl: NEXT_URL, @@ -73,8 +74,8 @@ const list = [ registrationRoutingName, registrationRoutingEmail, registrationRoutingGeneralPartners, - registrationRoutingNext, registrationRoutingLimitedPartners, + registrationRoutingNext, ]; export const registrationsRouting: PagesRouting = new Map< diff --git a/src/routes/registration.ts b/src/routes/registration.ts index bbc7140..745efb4 100644 --- a/src/routes/registration.ts +++ b/src/routes/registration.ts @@ -55,13 +55,13 @@ export const registrationEndpoints = ( ); router.get( - NEXT_URL, + LIMITED_PARTNERS_URL, authentication, dependencies.registrationController.getPageRouting() ); router.get( - LIMITED_PARTNERS_URL, + NEXT_URL, authentication, dependencies.registrationController.getPageRouting() ); From 75119c0fe86e47e8dc9a9d7004852afeb193e832 Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 11:07:01 +0000 Subject: [PATCH 4/7] resolve review comments --- src/presentation/controller/registration/Routing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/presentation/controller/registration/Routing.ts b/src/presentation/controller/registration/Routing.ts index a7b0440..f1a28af 100644 --- a/src/presentation/controller/registration/Routing.ts +++ b/src/presentation/controller/registration/Routing.ts @@ -26,7 +26,6 @@ export const LIMITED_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${LIMITED_PARTNERS_TEM export const NEXT_URL = `${BASE_WITH_IDS_URL}/${NEXT_TEMPLATE}`; - const registrationRoutingPartnershipType = { previousUrl: START_URL, currentUrl: WHICH_TYPE_URL, @@ -76,6 +75,7 @@ const list = [ registrationRoutingGeneralPartners, registrationRoutingLimitedPartners, registrationRoutingNext, + ]; export const registrationsRouting: PagesRouting = new Map< From 07a91dd2c278216d7a814a75de86fe714c643d58 Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 11:24:43 +0000 Subject: [PATCH 5/7] resolve review comments --- src/views/limited-partners.njk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/views/limited-partners.njk b/src/views/limited-partners.njk index 93dd4a6..86ada2d 100644 --- a/src/views/limited-partners.njk +++ b/src/views/limited-partners.njk @@ -1,9 +1,5 @@ {% extends "layout.njk" %} -{% block beforeContent %} - {% include "includes/back-link.njk" %} -{% endblock %} - {% block content %}
From 72af4d81ed156a0fc3a4bb3ada839d2c5d082f8c Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 11:36:55 +0000 Subject: [PATCH 6/7] add test for page --- .../registration/limited-partners.test.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/presentation/test/integration/registration/limited-partners.test.ts diff --git a/src/presentation/test/integration/registration/limited-partners.test.ts b/src/presentation/test/integration/registration/limited-partners.test.ts new file mode 100644 index 0000000..449eb13 --- /dev/null +++ b/src/presentation/test/integration/registration/limited-partners.test.ts @@ -0,0 +1,36 @@ +import request from "supertest"; +import { LocalesService } from "@companieshouse/ch-node-utils"; +import * as config from "../../../../config/constants"; +import enTranslationText from "../../../../../locales/en/translations.json"; +import cyTranslationText from "../../../../../locales/cy/translations.json"; +import app from "../app"; +import { + LIMITED_PARTNERS_URL, +} from "../../../controller/registration/Routing"; + +describe("Limited Partners Page", () => { + beforeEach(() => { + setLocalesEnabled(false); + }); + + const setLocalesEnabled = (bool: boolean) => { + jest.spyOn(config, "isLocalesEnabled").mockReturnValue(bool); + LocalesService.getInstance().enabled = bool; + }; + + it("should load the limited partners page with Welsh text", async () => { + setLocalesEnabled(true); + const res = await request(app).get(LIMITED_PARTNERS_URL + "?lang=cy"); + + expect(res.status).toBe(200); + expect(res.text).toContain(cyTranslationText.limitedPartnersPage.title); + }); + + it("should load the limited partners page with English text", async () => { + setLocalesEnabled(true); + const res = await request(app).get(LIMITED_PARTNERS_URL + "?lang=en"); + + expect(res.status).toBe(200); + expect(res.text).toContain(enTranslationText.limitedPartnersPage.title); + }); +}); \ No newline at end of file From 373ec6a3560cb29f2f82ec01054227684ed20fc3 Mon Sep 17 00:00:00 2001 From: hatidev Date: Tue, 10 Dec 2024 11:37:54 +0000 Subject: [PATCH 7/7] add test for page --- .../test/integration/registration/limited-partners.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/presentation/test/integration/registration/limited-partners.test.ts b/src/presentation/test/integration/registration/limited-partners.test.ts index 449eb13..23da1b3 100644 --- a/src/presentation/test/integration/registration/limited-partners.test.ts +++ b/src/presentation/test/integration/registration/limited-partners.test.ts @@ -33,4 +33,4 @@ describe("Limited Partners Page", () => { expect(res.status).toBe(200); expect(res.text).toContain(enTranslationText.limitedPartnersPage.title); }); -}); \ No newline at end of file +});