Skip to content

Commit 48e21be

Browse files
committed
LP-924 Update tests for welsh lang
1 parent 3c0be18 commit 48e21be

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import app from "../../../app";
44
import enTranslationText from "../../../../../../../locales/en/translations.json";
55
import cyTranslationText from "../../../../../../../locales/cy/translations.json";
66
import enErrorMessages from "../../../../../../../locales/en/errors.json";
7+
import cyErrorMessages from "../../../../../../../locales/cy/errors.json";
78

89
import { getUrl, setLocalesEnabled, testTranslations } from "../../../../utils";
910
import {
@@ -127,14 +128,18 @@ describe("Confirm General Partner Correspondence Address Page", () => {
127128
expect(res.text).toContain("You must provide an address");
128129
});
129130

130-
it("should show validation error message if validation error occurs when saving address", async () => {
131-
const res = await request(app).post(URL).send({
131+
it.each([
132+
[ "en", enErrorMessages, ],
133+
[ "cy", cyErrorMessages ]
134+
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
135+
setLocalesEnabled(true);
136+
const res = await request(app).post(`${URL}?lang=${lang}`).send({
132137
pageType: AddressPageType.confirmGeneralPartnerCorrespondenceAddress,
133138
address: `{"postal_code": "ST6 3LJ","premises": "4","address_line_1": "DUNCALF STREET","address_line_2": "","locality": "STOKE-ON-TRENT","country": ""}`
134139
});
135140

136141
expect(res.status).toBe(200);
137-
expect(res.text).toContain(enErrorMessages.errorMessages.address.confirm.countryMissing);
142+
expect(res.text).toContain(errorMessagesJson.errorMessages.address.confirm.countryMissing);
138143
});
139144
});
140145
});

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import request from "supertest";
33
import enTranslationText from "../../../../../../../locales/en/translations.json";
44
import cyTranslationText from "../../../../../../../locales/cy/translations.json";
55
import enErrorMessages from "../../../../../../../locales/en/errors.json";
6+
import cyErrorMessages from "../../../../../../../locales/cy/errors.json";
67

78
import app from "../../../app";
89
import { getUrl, setLocalesEnabled, testTranslations } from "../../../../utils";
@@ -128,14 +129,18 @@ describe("Confirm General Partner Principal Office Address Page", () => {
128129
expect(res.text).toContain("You must provide an address");
129130
});
130131

131-
it("should show validation error message if validation error occurs when saving address", async () => {
132-
const res = await request(app).post(URL).send({
132+
it.each([
133+
[ "en", enErrorMessages, ],
134+
[ "cy", cyErrorMessages ]
135+
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
136+
setLocalesEnabled(true);
137+
const res = await request(app).post(`${URL}?lang=${lang}`).send({
133138
pageType: AddressPageType.confirmGeneralPartnerPrincipalOfficeAddress,
134139
address: `{"postal_code": "ST6 3LJ","premises": "4","address_line_1": "DUNCALF STREET","address_line_2": "","locality": "STOKE-ON-TRENT","country": ""}`
135140
});
136141

137142
expect(res.status).toBe(200);
138-
expect(res.text).toContain(enErrorMessages.errorMessages.address.confirm.countryMissing);
143+
expect(res.text).toContain(errorMessagesJson.errorMessages.address.confirm.countryMissing);
139144
});
140145
});
141146
});

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import app from "../../../app";
44
import enTranslationText from "../../../../../../../locales/en/translations.json";
55
import cyTranslationText from "../../../../../../../locales/cy/translations.json";
66
import enErrorMessages from "../../../../../../../locales/en/errors.json";
7+
import cyErrorMessages from "../../../../../../../locales/cy/errors.json";
78

89
import { getUrl, setLocalesEnabled, testTranslations } from "../../../../utils";
910
import {
@@ -135,14 +136,18 @@ describe("Confirm General Partner Usual Residential Address Page", () => {
135136
expect(res.text).toContain("You must provide an address");
136137
});
137138

138-
it("should show validation error message if validation error occurs when saving address", async () => {
139-
const res = await request(app).post(URL).send({
139+
it.each([
140+
[ "en", enErrorMessages, ],
141+
[ "cy", cyErrorMessages ]
142+
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
143+
setLocalesEnabled(true);
144+
const res = await request(app).post(`${URL}?lang=${lang}`).send({
140145
pageType: AddressPageType.confirmGeneralPartnerUsualResidentialAddress,
141146
address: `{"postal_code": "ST6 3LJ","premises": "4","address_line_1": "DUNCALF STREET","address_line_2": "","locality": "STOKE-ON-TRENT","country": ""}`
142147
});
143148

144149
expect(res.status).toBe(200);
145-
expect(res.text).toContain(enErrorMessages.errorMessages.address.confirm.countryMissing);
150+
expect(res.text).toContain(errorMessagesJson.errorMessages.address.confirm.countryMissing);
146151
});
147152

148153
it("should redirect to the confirm correspondance address if already saved", async () => {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import request from "supertest";
33
import enTranslationText from "../../../../../../../locales/en/translations.json";
44
import cyTranslationText from "../../../../../../../locales/cy/translations.json";
55
import enErrorMessages from "../../../../../../../locales/en/errors.json";
6+
import cyErrorMessages from "../../../../../../../locales/cy/errors.json";
67

78
import app from "../../../app";
89
import { getUrl, setLocalesEnabled, testTranslations } from "../../../../utils";
@@ -128,14 +129,18 @@ describe("Confirm Limited Partner Principal Office Address Page", () => {
128129
expect(res.text).toContain("You must provide an address");
129130
});
130131

131-
it("should show validation error message if validation error occurs when saving address", async () => {
132-
const res = await request(app).post(URL).send({
132+
it.each([
133+
[ "en", enErrorMessages, ],
134+
[ "cy", cyErrorMessages ]
135+
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
136+
setLocalesEnabled(true);
137+
const res = await request(app).post(`${URL}?lang=${lang}`).send({
133138
pageType: AddressPageType.confirmLimitedPartnerPrincipalOfficeAddress,
134139
address: `{"postal_code": "ST6 3LJ","premises": "4","address_line_1": "DUNCALF STREET","address_line_2": "","locality": "STOKE-ON-TRENT","country": ""}`
135140
});
136141

137142
expect(res.status).toBe(200);
138-
expect(res.text).toContain(enErrorMessages.errorMessages.address.confirm.countryMissing);
143+
expect(res.text).toContain(errorMessagesJson.errorMessages.address.confirm.countryMissing);
139144
});
140145
});
141146
});

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import app from "../../../app";
44
import enTranslationText from "../../../../../../../locales/en/translations.json";
55
import cyTranslationText from "../../../../../../../locales/cy/translations.json";
66
import enErrorMessages from "../../../../../../../locales/en/errors.json";
7+
import cyErrorMessages from "../../../../../../../locales/cy/errors.json";
78

89
import { getUrl, setLocalesEnabled, testTranslations } from "../../../../utils";
910
import {
@@ -134,14 +135,18 @@ describe("Confirm Limited Partner Usual Residential Address Page", () => {
134135
expect(res.text).toContain("You must provide an address");
135136
});
136137

137-
it("should show validation error message if validation error occurs when saving address", async () => {
138-
const res = await request(app).post(URL).send({
138+
it.each([
139+
[ "en", enErrorMessages, ],
140+
[ "cy", cyErrorMessages ]
141+
])("should show validation error message if validation error occurs when saving address with lang %s", async (lang: string, errorMessagesJson: any) => {
142+
setLocalesEnabled(true);
143+
const res = await request(app).post(`${URL}?lang=${lang}`).send({
139144
pageType: AddressPageType.confirmLimitedPartnerUsualResidentialAddress,
140145
address: `{"postal_code": "ST6 3LJ","premises": "4","address_line_1": "DUNCALF STREET","address_line_2": "","locality": "STOKE-ON-TRENT","country": ""}`
141146
});
142147

143148
expect(res.status).toBe(200);
144-
expect(res.text).toContain(enErrorMessages.errorMessages.address.confirm.countryMissing);
149+
expect(res.text).toContain(errorMessagesJson.errorMessages.address.confirm.countryMissing);
145150
});
146151
});
147152
});

0 commit comments

Comments
 (0)