Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
HatiDev committed Dec 10, 2024
2 parents 373ec6a + fb4e29c commit d5bcd16
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 7 deletions.
18 changes: 18 additions & 0 deletions locales/cy/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
"nameEnding" : "WELSH - Which private fund limited partnership name ending would you prefer to go on the public record?"
},

"scottishNamePage" : {
"title" : "WELSH - Scottish limited partnership name",
"whatIsName" : "WELSH - What's the name of the Scottish limited partnership?",
"whatIsNameHint" : "WELSH - Do not enter a name ending like Limited Partnership or LP. We will add this for you.",
"nameEndingHint" : "WELSH - There's no difference between the name endings Limited Partnership, LP and L.P. except for how they look.",
"existingPartnershipHint" : "WELSH - You must check the name is not the same as an existing partnership or company on the <a href='https://find-and-update.company-information.service.gov.uk/company-name-availability' target='_blank'>Companies House register (opens in a new tab)</a>. If it is, we’ll reject your application.",
"sensitiveWordHint" : "WELSH - If the name includes <a href='https://www.gov.uk/government/publications/incorporation-and-names/annex-a-sensitive-words-and-expressions-or-words-that-could-imply-a-connection-with-government' target='_blank'>sensitive words or expressions that require approval (opens in a new tab)</a>, you must get permission before you register.",
"existingTrademarkHint" : "WELSH - Use the <a href='https://www.gov.uk/search-for-trademark' target='_blank'>trade mark search (link opens in a new tab)</a> to check if your name matches an existing trade mark. If it does, consider choosing a different name. Companies House will not carry out this check for you.",
"nameEnding" : "WELSH - Which private fund limited partnership name ending would you prefer to go on the public record?"
},

"privateNameScottishPage" : {
"title" : "WELSH - Scottish private fund limited partnership name",
"whatIsName" : "WELSH - What's the name of the private fund limited partnership?",
Expand Down Expand Up @@ -70,6 +81,13 @@
"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.",
"person": "WELSH - A person",
"legalEntity": "WELSH - A legal entity"
},

"pageNotFound" : {
"title" : "WELSH - Page Not Found",
Expand Down
18 changes: 18 additions & 0 deletions locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
"nameEnding" : "Which private fund limited partnership name ending would you prefer to go on the public record?"
},

"scottishNamePage" : {
"title" : "Scottish limited partnership name",
"whatIsName" : "What's the name of the Scottish limited partnership?",
"whatIsNameHint" : "Do not enter a name ending like Limited Partnership or LP. We will add this for you.",
"nameEndingHint" : "There's no difference between the name endings Limited Partnership, LP and L.P. except for how they look.",
"existingPartnershipHint" : "You must check the name is not the same as an existing partnership or company on the <a href='https://find-and-update.company-information.service.gov.uk/company-name-availability' target='_blank'>Companies House register (opens in a new tab)</a>. If it is, we’ll reject your application.",
"sensitiveWordHint" : "If the name includes <a href='https://www.gov.uk/government/publications/incorporation-and-names/annex-a-sensitive-words-and-expressions-or-words-that-could-imply-a-connection-with-government' target='_blank'>sensitive words or expressions that require approval (opens in a new tab)</a>, you must get permission before you register.",
"existingTrademarkHint" : "Use the <a href='https://www.gov.uk/search-for-trademark' target='_blank'>trade mark search (link opens in a new tab)</a> to check if your name matches an existing trade mark. If it does, consider choosing a different name. Companies House will not carry out this check for you.",
"nameEnding" : "Which private fund limited partnership name ending would you prefer to go on the public record?"
},

"privateNameScottishPage" : {
"title" : "Scottish private fund limited partnership name",
"whatIsName" : "What's the name of the private fund limited partnership?",
Expand Down Expand Up @@ -70,6 +81,13 @@
"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.",
"person": "A person",
"legalEntity": "A legal entity"
},

"pageNotFound" : {
"title" : "Page not found",
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 @@ -4,6 +4,7 @@ enum RegistrationPageType {
email = "email",
generalPartners = "general-partners",
limitedPartners = "limited-partners",
generalPartnerChoice = "general-partner-choice",
next = "next",
}

Expand Down
12 changes: 11 additions & 1 deletion src/presentation/controller/registration/Routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 @@ -21,6 +22,7 @@ export const NAME_URL = `${BASE_URL}/${NAME_TEMPLATE}`;
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}`;

Expand Down Expand Up @@ -50,7 +52,7 @@ const registrationRoutingEmail = {
const registrationRoutingGeneralPartners = {
previousUrl: EMAIL_URL,
currentUrl: GENERAL_PARTNERS_URL,
nextUrl: NEXT_URL,
nextUrl: GENERAL_PARTNER_CHOICE_URL,
pageType: RegistrationPageType.generalPartners,
};

Expand All @@ -61,6 +63,13 @@ const registrationRoutingLimitedPartners = {
pageType: RegistrationPageType.limitedPartners,
};

const registrationRoutingGeneralPartnerChoice = {
previousUrl: GENERAL_PARTNERS_URL,
currentUrl: GENERAL_PARTNER_CHOICE_URL,
nextUrl: NEXT_URL,
pageType: RegistrationPageType.generalPartnerChoice,
};

const registrationRoutingNext = {
previousUrl: GENERAL_PARTNERS_URL,
currentUrl: NEXT_URL,
Expand All @@ -74,6 +83,7 @@ const list = [
registrationRoutingEmail,
registrationRoutingGeneralPartners,
registrationRoutingLimitedPartners,
registrationRoutingGeneralPartnerChoice,
registrationRoutingNext,

];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 {
GENERAL_PARTNER_CHOICE_URL,
NEXT_URL,
} from "../../../controller/registration/Routing";
import RegistrationPageType from "../../../../presentation/controller/registration/PageType";

describe("General Partner Choice Page", () => {
beforeEach(() => {
setLocalesEnabled(false);
});

const setLocalesEnabled = (bool: boolean) => {
jest.spyOn(config, "isLocalesEnabled").mockReturnValue(bool);
LocalesService.getInstance().enabled = bool;
};

it("should load the general partner choice page with Welsh text", async () => {
setLocalesEnabled(true);
const res = await request(app).get(GENERAL_PARTNER_CHOICE_URL + "?lang=cy");

expect(res.status).toBe(200);
expect(res.text).toContain(cyTranslationText.generalPartnerChoicePage.title);
});

it("should load the general partner choice page with English text", async () => {
setLocalesEnabled(true);
const res = await request(app).get(GENERAL_PARTNER_CHOICE_URL + "?lang=en");

expect(res.status).toBe(200);
expect(res.text).toContain(enTranslationText.generalPartnerChoicePage.title);
});

it("should redirect to next page when choice is selected", async () => {
const selectedType = "person";
const res = await request(app).post(GENERAL_PARTNER_CHOICE_URL).send({
pageType: RegistrationPageType.generalPartnerChoice,
parameter: selectedType,
});

const redirectUrl = `${NEXT_URL}?${RegistrationPageType.generalPartnerChoice}=${selectedType}`;
expect(res.status).toBe(302);
expect(res.text).toContain(redirectUrl);
});
});
21 changes: 21 additions & 0 deletions src/presentation/test/integration/registration/name.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ describe("Name Page", () => {
expect(res.text).not.toContain("WELSH -");
});

it("should load the Scottish limited partnership name page with Welsh text", async () => {
setLocalesEnabled(true);
const res = await request(app).get(NAME_URL + "?lang=cy&which-type=registerSlp");

expect(res.status).toBe(200);
expect(res.text).toContain(cyTranslationText.scottishNamePage.title);
expect(res.text).toContain(cyTranslationText.scottishNamePage.nameEnding);
expect(res.text).toContain(cyTranslationText.buttons.saveAndContinue);
});

it("should load the Scottish limited partnership name page with English text", async () => {
setLocalesEnabled(true);
const res = await request(app).get(NAME_URL + "?lang=en&which-type=registerSlp");

expect(res.status).toBe(200);
expect(res.text).toContain(enTranslationText.scottishNamePage.title);
expect(res.text).toContain(enTranslationText.scottishNamePage.nameEnding);
expect(res.text).toContain(enTranslationText.buttons.saveAndContinue);
expect(res.text).not.toContain("WELSH -");
});

it("should load the private name Scotland page with Welsh text", async () => {
setLocalesEnabled(true);
const res = await request(app).get(NAME_URL + "?lang=cy&which-type=registerPflpSco");
Expand Down
19 changes: 14 additions & 5 deletions src/routes/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
WHICH_TYPE_URL,
LIMITED_PARTNERS_URL,
GENERAL_PARTNERS_URL,
GENERAL_PARTNER_CHOICE_URL,
} from "../presentation/controller/registration/Routing";

export const registrationEndpoints = (
Expand All @@ -37,23 +38,31 @@ export const registrationEndpoints = (
authentication,
dependencies.registrationController.createTransactionAndFirstSubmission()
);
router.get(
EMAIL_URL,
authentication,
dependencies.registrationController.getPageRouting()
);
router.post(
EMAIL_URL,
authentication,
dependencies.registrationController.sendPageData()
);
router.get(
GENERAL_PARTNERS_URL,
authentication,
dependencies.registrationController.getPageRouting()
);

router.get(
EMAIL_URL,
GENERAL_PARTNER_CHOICE_URL,
authentication,
dependencies.registrationController.getPageRouting()
);
router.post(
EMAIL_URL,
GENERAL_PARTNER_CHOICE_URL,
authentication,
dependencies.registrationController.sendPageData()
dependencies.registrationController.redirectWithParameter()
);

router.get(
LIMITED_PARTNERS_URL,
authentication,
Expand Down
52 changes: 52 additions & 0 deletions src/views/general-partner-choice.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% extends "layout.njk" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form class="form" action={{ props.currentUrl }} method="post">
<input type="hidden" name="pageType" value={{ props.pageType }}>

{% include "includes/csrf_token.njk" %}

{{ govukRadios({
classes: "govuk-radios",
name: "parameter",
value: data['generalPartner'],
fieldset: {
legend: {
text: i18n.generalPartnerChoicePage.title,
isPageHeading: true,
classes: "govuk-fieldset__legend--xl"
}
},
hint: {
text: i18n.generalPartnerChoicePage.hint
},

items: [
{
value: "person",
text: i18n.generalPartnerChoicePage.person,
id: "person",
name: "person",
attributes: {
required: true
}
},
{
value: "legalEntity",
text: i18n.generalPartnerChoicePage.legalEntity,
id: "legal_entity",
name: "legal_entity",
attributes: {
required: true
}
}
]
}) }}

{% include "includes/continue-button.njk" %}
</form>
</div>
</div>
{% endblock %}
4 changes: 3 additions & 1 deletion src/views/name.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
{% if props.parameters['which-type'] == "registerLp" %}
{% include "pages/name/limited-partnership-name.njk" %}
{% elif props.parameters['which-type'] == "registerPflp" %}
{% include "pages/name/private-limited-partnership-name.njk" %}
{% include "pages/name/private-limited-partnership-name.njk" %}
{% elif props.parameters['which-type'] == "registerSlp" %}
{% include "pages/name/scottish-limited-partnership-name.njk" %}
{% elif props.parameters['which-type'] == "registerPflpSco" %}
{% include "pages/name/private-limited-partnership-name-scotland.njk" %}
{% else %}
Expand Down
Loading

0 comments on commit d5bcd16

Please sign in to comment.