Skip to content

Commit

Permalink
Merge pull request #88 from companieshouse/lp238-create-you-need-to-t…
Browse files Browse the repository at this point in the history
…ell-us-about-the-limited-partners-page

Create now you need to tell us about limited partners page
  • Loading branch information
HatiDev authored Dec 10, 2024
2 parents fb4e29c + d5bcd16 commit 0037401
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 0 deletions.
5 changes: 5 additions & 0 deletions locales/cy/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
5 changes: 5 additions & 0 deletions locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions src/presentation/controller/registration/PageType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum RegistrationPageType {
name = "name",
email = "email",
generalPartners = "general-partners",
limitedPartners = "limited-partners",
generalPartnerChoice = "general-partner-choice",
next = "next",
}
Expand Down
12 changes: 12 additions & 0 deletions src/presentation/controller/registration/Routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand Down Expand Up @@ -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,
Expand All @@ -72,8 +82,10 @@ const list = [
registrationRoutingName,
registrationRoutingEmail,
registrationRoutingGeneralPartners,
registrationRoutingLimitedPartners,
registrationRoutingGeneralPartnerChoice,
registrationRoutingNext,

];

export const registrationsRouting: PagesRouting = new Map<
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});
});
7 changes: 7 additions & 0 deletions src/routes/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions src/views/limited-partners.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "layout.njk" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">

<h1 class="govuk-heading-xl">{{ i18n.limitedPartnersPage.title }}</h1>

<p class="govuk-body">{{ i18n.limitedPartnersPage.pageInformation }}</p>

<button class="govuk-button" onClick="location.href='{{ props.nextUrl }}'">{{ i18n.buttons.continue }}</button>

</div>
</div>
{% endblock %}

0 comments on commit 0037401

Please sign in to comment.