Skip to content

Commit 755e0f7

Browse files
authored
Merge pull request #605 from companieshouse/lp-1358-add-capital-cont-lpap03-04
LP-1358 Add capital contribution fields to post transition partner pages
2 parents 76d4657 + 6b5d724 commit 755e0f7

19 files changed

+113
-92
lines changed

src/presentation/test/integration/postTransition/generalPartner/address/confirm-general-partner-correspondence-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe("Confirm General Partner Correspondence Address Page", () => {
129129
});
130130

131131
it.each([
132-
[ "en", enErrorMessages, ],
132+
[ "en", enErrorMessages ],
133133
[ "cy", cyErrorMessages ]
134134
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
135135
setLocalesEnabled(true);

src/presentation/test/integration/postTransition/generalPartner/address/confirm-general-partner-principal-office-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe("Confirm General Partner Principal Office Address Page", () => {
130130
});
131131

132132
it.each([
133-
[ "en", enErrorMessages, ],
133+
[ "en", enErrorMessages ],
134134
[ "cy", cyErrorMessages ]
135135
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
136136
setLocalesEnabled(true);

src/presentation/test/integration/postTransition/generalPartner/address/confirm-general-partner-usual-residential-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe("Confirm General Partner Usual Residential Address Page", () => {
137137
});
138138

139139
it.each([
140-
[ "en", enErrorMessages, ],
140+
[ "en", enErrorMessages ],
141141
[ "cy", cyErrorMessages ]
142142
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
143143
setLocalesEnabled(true);

src/presentation/test/integration/postTransition/limitedPartner/add-limited-partner-legal-entity.test.ts

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { PartnerKind, PartnershipType } from "@companieshouse/api-sdk-node/dist/services/limited-partnerships/types";
2+
import { CompanyProfile } from "@companieshouse/api-sdk-node/dist/services/company-profile/types";
3+
14
import request from "supertest";
25

36
import enTranslationText from "../../../../../../locales/en/translations.json";
@@ -17,14 +20,13 @@ import {
1720

1821
import LimitedPartnerBuilder from "../../../builder/LimitedPartnerBuilder";
1922
import CompanyProfileBuilder from "../../../builder/CompanyProfileBuilder";
20-
import { PartnerKind } from "@companieshouse/api-sdk-node/dist/services/limited-partnerships/types";
2123
import { CONFIRM_LIMITED_PARTNER_PRINCIPAL_OFFICE_ADDRESS_URL, TERRITORY_CHOICE_LIMITED_PARTNER_PRINCIPAL_OFFICE_ADDRESS_URL } from "../../../../controller/addressLookUp/url/postTransition";
2224

2325
describe("Add Limited Partner Legal Entity Page", () => {
2426
const URL = getUrl(ADD_LIMITED_PARTNER_LEGAL_ENTITY_URL);
2527
const REDIRECT_URL = getUrl(TERRITORY_CHOICE_LIMITED_PARTNER_PRINCIPAL_OFFICE_ADDRESS_URL);
2628

27-
let companyProfile;
29+
let companyProfile: { Id: string; data: Partial<CompanyProfile> };
2830

2931
beforeEach(() => {
3032
setLocalesEnabled(false);
@@ -40,28 +42,46 @@ describe("Add Limited Partner Legal Entity Page", () => {
4042

4143
describe("Get Add Limited Partner Legal Entity Page", () => {
4244

43-
it("should load the add limited partner legal entity page with Welsh text", async () => {
44-
setLocalesEnabled(true);
45-
const res = await request(app).get(URL + "?lang=cy");
46-
47-
expect(res.status).toBe(200);
48-
expect(res.text).toContain(
49-
`${cyTranslationText.addPartnerLegalEntityPage.limitedPartner.title}`
50-
);
51-
testTranslations(res.text, cyTranslationText.addPartnerLegalEntityPage, ["errorMessages", "generalPartner"]);
52-
});
53-
54-
it("should load the add limited partner legal entity page with English text", async () => {
55-
setLocalesEnabled(true);
56-
const res = await request(app).get(URL + "?lang=en");
57-
58-
expect(res.status).toBe(200);
59-
expect(res.text).toContain(
60-
`${enTranslationText.addPartnerLegalEntityPage.limitedPartner.title}`
61-
);
62-
testTranslations(res.text, enTranslationText.addPartnerLegalEntityPage, ["errorMessages", "generalPartner"]);
63-
expect(res.text).not.toContain("WELSH -");
64-
});
45+
it.each(
46+
[
47+
[PartnershipType.LP, "en", enTranslationText, true],
48+
[PartnershipType.SLP, "en", enTranslationText, true],
49+
[PartnershipType.PFLP, "en", enTranslationText, false],
50+
[PartnershipType.SPFLP, "en", enTranslationText, false],
51+
[PartnershipType.LP, "cy", cyTranslationText, true],
52+
[PartnershipType.SLP, "cy", cyTranslationText, true],
53+
[PartnershipType.PFLP, "cy", cyTranslationText, false],
54+
[PartnershipType.SPFLP, "cy", cyTranslationText, false]
55+
]
56+
)("should load the add limited partner legal entity page for partnership type %s and language %s",
57+
async (
58+
partnershipType: PartnershipType,
59+
lang: string,
60+
i18n: any,
61+
expectCapitalContributionText: boolean
62+
) => {
63+
companyProfile.data.subtype = partnershipType;
64+
65+
setLocalesEnabled(true);
66+
const res = await request(app).get(URL + `?lang=${lang}`);
67+
68+
expect(res.status).toBe(200);
69+
expect(res.text).toContain(
70+
`${i18n.addPartnerLegalEntityPage.limitedPartner.title}`
71+
);
72+
testTranslations(res.text, i18n.addPartnerLegalEntityPage, ["errorMessages", "generalPartner"]);
73+
74+
if (expectCapitalContributionText) {
75+
expect(res.text).toContain(i18n.capitalContribution.title);
76+
} else {
77+
expect(res.text).not.toContain(i18n.capitalContribution.title);
78+
}
79+
80+
if (lang !== "cy") {
81+
expect(res.text).not.toContain("WELSH -");
82+
}
83+
}
84+
);
6585

6686
it("should contain a back link to the choice page when limited partners are not present", async () => {
6787
const res = await request(app).get(getUrl(ADD_LIMITED_PARTNER_LEGAL_ENTITY_WITH_IDS_URL) + "?lang=en");

src/presentation/test/integration/postTransition/limitedPartner/add-limited-partner-person.test.ts

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { PartnerKind, PartnershipType } from "@companieshouse/api-sdk-node/dist/services/limited-partnerships/types";
2+
import { CompanyProfile } from "@companieshouse/api-sdk-node/dist/services/company-profile/types";
3+
14
import request from "supertest";
25

36
import enTranslationText from "../../../../../../locales/en/translations.json";
@@ -18,13 +21,12 @@ import { CONFIRM_LIMITED_PARTNER_USUAL_RESIDENTIAL_ADDRESS_URL, TERRITORY_CHOICE
1821
import LimitedPartnerBuilder from "../../../builder/LimitedPartnerBuilder";
1922
import CompanyProfileBuilder from "../../../builder/CompanyProfileBuilder";
2023
import { POST_TRANSITION_WITH_ID_URL } from "../../../../../config/constants";
21-
import { PartnerKind } from "@companieshouse/api-sdk-node/dist/services/limited-partnerships/types";
2224

2325
describe("Add Limited Partner Person Page", () => {
2426
const URL = getUrl(ADD_LIMITED_PARTNER_PERSON_URL);
2527
const REDIRECT_URL = getUrl(TERRITORY_CHOICE_LIMITED_PARTNER_USUAL_RESIDENTIAL_ADDRESS_URL);
2628

27-
let companyProfile;
29+
let companyProfile: { Id: string; data: Partial<CompanyProfile> };
2830

2931
beforeEach(() => {
3032
setLocalesEnabled(false);
@@ -39,56 +41,55 @@ describe("Add Limited Partner Person Page", () => {
3941
});
4042

4143
describe("Get Add Limited Partner Page", () => {
42-
it("should load the add limited partner page with English text", async () => {
43-
const limitedPartnership = new LimitedPartnershipBuilder().build();
44-
45-
appDevDependencies.limitedPartnershipGateway.feedLimitedPartnerships([limitedPartnership]);
46-
47-
setLocalesEnabled(true);
48-
const res = await request(app).get(URL + "?lang=en");
49-
50-
expect(res.status).toBe(200);
5144

52-
expect(res.text).toContain(
53-
`${companyProfile.data.companyName.toUpperCase()} (${companyProfile.data.companyNumber.toUpperCase()})`
54-
);
55-
56-
testTranslations(res.text, enTranslationText.addPartnerPersonPage, ["errorMessages", "generalPartner"]);
57-
testTranslations(res.text, enTranslationText.limitedPartnersPage, [
58-
"title",
59-
"pageInformation",
60-
"disqualificationStatement",
61-
"disqualificationStatementLegend"
62-
]);
63-
expect(res.text).not.toContain("WELSH -");
64-
65-
expect(res.text).not.toContain(enTranslationText.capitalContribution.title);
66-
});
67-
68-
it("should load the add limited partner page with Welsh text", async () => {
69-
const limitedPartnership = new LimitedPartnershipBuilder().build();
70-
71-
appDevDependencies.limitedPartnershipGateway.feedLimitedPartnerships([limitedPartnership]);
72-
73-
setLocalesEnabled(true);
74-
const res = await request(app).get(URL + "?lang=cy");
75-
76-
expect(res.status).toBe(200);
77-
78-
expect(res.text).toContain(
79-
`${companyProfile.data.companyName.toUpperCase()} (${companyProfile.data.companyNumber.toUpperCase()})`
80-
);
81-
82-
testTranslations(res.text, cyTranslationText.addPartnerPersonPage, ["errorMessages", "generalPartner"]);
83-
testTranslations(res.text, cyTranslationText.limitedPartnersPage, [
84-
"title",
85-
"pageInformation",
86-
"disqualificationStatement",
87-
"disqualificationStatementLegend"
88-
]);
45+
it.each(
46+
[
47+
[PartnershipType.LP, "en", enTranslationText, true],
48+
[PartnershipType.SLP, "en", enTranslationText, true],
49+
[PartnershipType.PFLP, "en", enTranslationText, false],
50+
[PartnershipType.SPFLP, "en", enTranslationText, false],
51+
[PartnershipType.LP, "cy", cyTranslationText, true],
52+
[PartnershipType.SLP, "cy", cyTranslationText, true],
53+
[PartnershipType.PFLP, "cy", cyTranslationText, false],
54+
[PartnershipType.SPFLP, "cy", cyTranslationText, false]
55+
]
56+
)("should load the add limited partner person page for partnership type %s and language %s",
57+
async (
58+
partnershipType: PartnershipType,
59+
lang: string,
60+
i18n: any,
61+
expectCapitalContributionText: boolean
62+
) => {
63+
companyProfile.data.subtype = partnershipType;
64+
65+
setLocalesEnabled(true);
66+
const res = await request(app).get(URL + `?lang=${lang}`);
67+
68+
expect(res.status).toBe(200);
69+
70+
expect(res.text).toContain(
71+
`${companyProfile.data.companyName?.toUpperCase()} (${companyProfile.data.companyNumber?.toUpperCase()})`
72+
);
73+
74+
testTranslations(res.text, i18n.addPartnerPersonPage, ["errorMessages", "generalPartner"]);
75+
testTranslations(res.text, i18n.limitedPartnersPage, [
76+
"title",
77+
"pageInformation",
78+
"disqualificationStatement",
79+
"disqualificationStatementLegend"
80+
]);
81+
82+
if (expectCapitalContributionText) {
83+
expect(res.text).toContain(i18n.capitalContribution.title);
84+
} else {
85+
expect(res.text).not.toContain(i18n.capitalContribution.title);
86+
}
8987

90-
expect(res.text).not.toContain(cyTranslationText.capitalContribution.title);
91-
});
88+
if (lang !== "cy") {
89+
expect(res.text).not.toContain("WELSH -");
90+
}
91+
}
92+
);
9293

9394
it("should contain a back link to the choice page when limited partners are not present", async () => {
9495
const res = await request(app).get(getUrl(ADD_LIMITED_PARTNER_PERSON_WITH_IDS_URL) + "?lang=en");
@@ -109,7 +110,7 @@ describe("Add Limited Partner Person Page", () => {
109110

110111
expect(res.status).toBe(200);
111112
expect(res.text).toContain(
112-
`${companyProfile.data.companyName.toUpperCase()} (${companyProfile.data.companyNumber.toUpperCase()})`
113+
`${companyProfile.data.companyName?.toUpperCase()} (${companyProfile.data.companyNumber?.toUpperCase()})`
113114
);
114115
});
115116

src/presentation/test/integration/postTransition/limitedPartner/address/confirm-limited-partner-principal-office-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe("Confirm Limited Partner Principal Office Address Page", () => {
130130
});
131131

132132
it.each([
133-
[ "en", enErrorMessages, ],
133+
[ "en", enErrorMessages ],
134134
[ "cy", cyErrorMessages ]
135135
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
136136
setLocalesEnabled(true);

src/presentation/test/integration/postTransition/limitedPartner/address/confirm-limited-partner-usual-residential-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe("Confirm Limited Partner Usual Residential Address Page", () => {
136136
});
137137

138138
it.each([
139-
[ "en", enErrorMessages, ],
139+
[ "en", enErrorMessages ],
140140
[ "cy", cyErrorMessages ]
141141
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
142142
setLocalesEnabled(true);

src/presentation/test/integration/registration/generalPartner/address/confirm-general-partner-correspondence-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe("Confirm General Partner Correspondence Address Page", () => {
128128
});
129129

130130
it.each([
131-
[ "en", enErrorMessages, ],
131+
[ "en", enErrorMessages ],
132132
[ "cy", cyErrorMessages ]
133133
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
134134
setLocalesEnabled(true);

src/presentation/test/integration/registration/generalPartner/address/confirm-general-partner-principal-office-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe("Confirm General Partner Principal Office Address Page", () => {
128128
});
129129

130130
it.each([
131-
[ "en", enErrorMessages, ],
131+
[ "en", enErrorMessages ],
132132
[ "cy", cyErrorMessages ]
133133
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
134134
setLocalesEnabled(true);

src/presentation/test/integration/registration/generalPartner/address/confirm-general-partner-usual-residential-address.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe("Confirm General Partner Usual Residential Address Page", () => {
135135
});
136136

137137
it.each([
138-
[ "en", enErrorMessages, ],
138+
[ "en", enErrorMessages ],
139139
[ "cy", cyErrorMessages ]
140140
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
141141
setLocalesEnabled(true);

0 commit comments

Comments
 (0)