11import { PartnerKind , PartnershipType } from "@companieshouse/api-sdk-node/dist/services/limited-partnerships/types" ;
22import { CompanyProfile } from "@companieshouse/api-sdk-node/dist/services/company-profile/types" ;
33
4- import request , { Response } from "supertest" ;
4+ import request from "supertest" ;
55
66import enTranslationText from "../../../../../../locales/en/translations.json" ;
77import cyTranslationText from "../../../../../../locales/cy/translations.json" ;
@@ -42,28 +42,23 @@ describe("Add Limited Partner Legal Entity Page", () => {
4242
4343 describe ( "Get Add Limited Partner Legal Entity Page" , ( ) => {
4444
45- const expectEnglishCapitalContributionText = ( res : Response ) => expect ( res . text ) . toContain ( enTranslationText . capitalContribution . title ) ;
46- const expectNoEnglishCapitalContributionText = ( res : Response ) => expect ( res . text ) . not . toContain ( enTranslationText . capitalContribution . title ) ;
47- const expectWelshCapitalContributionText = ( res : Response ) => expect ( res . text ) . toContain ( cyTranslationText . capitalContribution . title ) ;
48- const expectNoWelshCapitalContributionText = ( res : Response ) => expect ( res . text ) . not . toContain ( cyTranslationText . capitalContribution . title ) ;
49-
5045 it . each (
5146 [
52- [ PartnershipType . LP , "en" , enTranslationText , expectEnglishCapitalContributionText ] ,
53- [ PartnershipType . SLP , "en" , enTranslationText , expectEnglishCapitalContributionText ] ,
54- [ PartnershipType . PFLP , "en" , enTranslationText , expectNoEnglishCapitalContributionText ] ,
55- [ PartnershipType . SPFLP , "en" , enTranslationText , expectNoEnglishCapitalContributionText ] ,
56- [ PartnershipType . LP , "cy" , cyTranslationText , expectWelshCapitalContributionText ] ,
57- [ PartnershipType . SLP , "cy" , cyTranslationText , expectWelshCapitalContributionText ] ,
58- [ PartnershipType . PFLP , "cy" , cyTranslationText , expectNoWelshCapitalContributionText ] ,
59- [ PartnershipType . SPFLP , "cy" , cyTranslationText , expectNoWelshCapitalContributionText ]
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 ]
6055 ]
6156 ) ( "should load the add limited partner legal entity page for partnership type %s and language %s" ,
6257 async (
6358 partnershipType : PartnershipType ,
6459 lang : string ,
6560 i18n : any ,
66- capitalContributionAssertion : ( res : Response ) => void
61+ expectCapitalContributionText : boolean
6762 ) => {
6863 companyProfile . data . subtype = partnershipType ;
6964
@@ -75,7 +70,12 @@ describe("Add Limited Partner Legal Entity Page", () => {
7570 `${ i18n . addPartnerLegalEntityPage . limitedPartner . title } `
7671 ) ;
7772 testTranslations ( res . text , i18n . addPartnerLegalEntityPage , [ "errorMessages" , "generalPartner" ] ) ;
78- capitalContributionAssertion ( res ) ;
73+
74+ if ( expectCapitalContributionText ) {
75+ expect ( res . text ) . toContain ( i18n . capitalContribution . title ) ;
76+ } else {
77+ expect ( res . text ) . not . toContain ( i18n . capitalContribution . title ) ;
78+ }
7979
8080 if ( lang !== "cy" ) {
8181 expect ( res . text ) . not . toContain ( "WELSH -" ) ;
0 commit comments