diff --git a/locales/cy/translations.json b/locales/cy/translations.json index a61fdad..d460c00 100644 --- a/locales/cy/translations.json +++ b/locales/cy/translations.json @@ -77,6 +77,11 @@ "pageInformation": "WELSH - If the partnership has more than one general partner, you'll add them one at a time." }, + "limitedPartnersPage": { + "title": "WELSH - You now need to tell us about the limited partners", + "pageInformation": "WELSH - If the partnership has more than one limited partner, you'll add them one at a time." + }, + "generalPartnerChoicePage": { "title": "WELSH - You now need to tell us about the general partners", "hint": "WELSH - You can add more later.", diff --git a/locales/en/translations.json b/locales/en/translations.json index 66a45b6..592c359 100644 --- a/locales/en/translations.json +++ b/locales/en/translations.json @@ -77,6 +77,11 @@ "pageInformation": "If the partnership has more than one general partner, you'll add them one at a time." }, + "limitedPartnersPage": { + "title": "You now need to tell us about the limited partners", + "pageInformation": "If the partnership has more than one limited partner, you'll add them one at a time." + }, + "generalPartnerChoicePage": { "title": "Is the general partner a person or a legal entity?", "hint": "You can add more later.", diff --git a/src/presentation/controller/registration/PageType.ts b/src/presentation/controller/registration/PageType.ts index 98a526c..f5b0015 100644 --- a/src/presentation/controller/registration/PageType.ts +++ b/src/presentation/controller/registration/PageType.ts @@ -3,6 +3,7 @@ enum RegistrationPageType { name = "name", email = "email", generalPartners = "general-partners", + limitedPartners = "limited-partners", generalPartnerChoice = "general-partner-choice", next = "next", } diff --git a/src/presentation/controller/registration/Routing.ts b/src/presentation/controller/registration/Routing.ts index 688fc4b..49880b4 100644 --- a/src/presentation/controller/registration/Routing.ts +++ b/src/presentation/controller/registration/Routing.ts @@ -12,6 +12,7 @@ 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 GENERAL_PARTNER_CHOICE_TEMPLATE = RegistrationPageType.generalPartnerChoice; export const NEXT_TEMPLATE = RegistrationPageType.next; @@ -23,6 +24,8 @@ export const EMAIL_URL = `${BASE_WITH_IDS_URL}/${EMAIL_TEMPLATE}`; export const GENERAL_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${GENERAL_PARTNERS_TEMPLATE}`; export const GENERAL_PARTNER_CHOICE_URL = `${BASE_WITH_IDS_URL}/${GENERAL_PARTNER_CHOICE_TEMPLATE}`; +export const LIMITED_PARTNERS_URL = `${BASE_WITH_IDS_URL}/${LIMITED_PARTNERS_TEMPLATE}`; + export const NEXT_URL = `${BASE_WITH_IDS_URL}/${NEXT_TEMPLATE}`; const registrationRoutingPartnershipType = { @@ -53,6 +56,13 @@ const registrationRoutingGeneralPartners = { pageType: RegistrationPageType.generalPartners, }; +const registrationRoutingLimitedPartners = { + previousUrl: WHICH_TYPE_URL, + currentUrl: LIMITED_PARTNERS_URL, + nextUrl: NEXT_URL, + pageType: RegistrationPageType.limitedPartners, +}; + const registrationRoutingGeneralPartnerChoice = { previousUrl: GENERAL_PARTNERS_URL, currentUrl: GENERAL_PARTNER_CHOICE_URL, @@ -72,8 +82,10 @@ const list = [ registrationRoutingName, registrationRoutingEmail, registrationRoutingGeneralPartners, + registrationRoutingLimitedPartners, registrationRoutingGeneralPartnerChoice, registrationRoutingNext, + ]; export const registrationsRouting: PagesRouting = new Map< 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..23da1b3 --- /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); + }); +}); diff --git a/src/routes/registration.ts b/src/routes/registration.ts index f351da3..1c4fe90 100644 --- a/src/routes/registration.ts +++ b/src/routes/registration.ts @@ -9,6 +9,7 @@ import { NAME_URL, NEXT_URL, WHICH_TYPE_URL, + LIMITED_PARTNERS_URL, GENERAL_PARTNERS_URL, GENERAL_PARTNER_CHOICE_URL, } from "../presentation/controller/registration/Routing"; @@ -62,6 +63,12 @@ export const registrationEndpoints = ( authentication, dependencies.registrationController.redirectWithParameter() ); + router.get( + LIMITED_PARTNERS_URL, + authentication, + dependencies.registrationController.getPageRouting() + ); + router.get( NEXT_URL, authentication, diff --git a/src/views/limited-partners.njk b/src/views/limited-partners.njk new file mode 100644 index 0000000..86ada2d --- /dev/null +++ b/src/views/limited-partners.njk @@ -0,0 +1,15 @@ +{% extends "layout.njk" %} + +{% block content %} +
+
+ +

{{ i18n.limitedPartnersPage.title }}

+ +

{{ i18n.limitedPartnersPage.pageInformation }}

+ + + +
+
+{% endblock %} \ No newline at end of file