Skip to content

Commit 47739bd

Browse files
committed
LP-1084 Update existing tests for former names
1 parent 54ed09f commit 47739bd

File tree

6 files changed

+59
-12
lines changed

6 files changed

+59
-12
lines changed

src/presentation/test/integration/postTransition/generalPartner/add-general-partner-person.test.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,26 @@ describe("Add General Partner Person Page", () => {
125125
});
126126

127127
describe("Post Add General Partner Person", () => {
128-
it("should send the general partner person details", async () => {
129-
const generalPartner = new GeneralPartnerBuilder().isPerson().withNotDisqualifiedStatementChecked(true).build();
128+
it.each([
129+
"true",
130+
"false"
131+
])("should send the general partner person details", async (previousName) => {
132+
const generalPartner = new GeneralPartnerBuilder()
133+
.isPerson()
134+
.withNotDisqualifiedStatementChecked(true)
135+
.build();
136+
137+
if (previousName === "true") {
138+
if (generalPartner.data) {
139+
generalPartner.data.former_names = "john";
140+
}
141+
}
130142

131143
const res = await request(app)
132144
.post(URL)
133145
.send({
134146
pageType: PostTransitionPageType.addGeneralPartnerPerson,
147+
previousName: previousName,
135148
...generalPartner.data
136149
});
137150

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,27 @@ describe("Add Limited Partner Person Page", () => {
137137
});
138138

139139
describe("Post Add Limited Partner", () => {
140-
it("should send the Limited partner details", async () => {
141-
const limitedPartner = new LimitedPartnerBuilder().isPerson().withNotDisqualifiedStatementChecked(true).build();
140+
it.each([
141+
"true",
142+
"false"
143+
])("should send the Limited partner details", async (previousName) => {
144+
const limitedPartner = new LimitedPartnerBuilder()
145+
.isPerson()
146+
.withNotDisqualifiedStatementChecked(true)
147+
.withFormerNames("john")
148+
.build();
149+
150+
if (previousName === "true") {
151+
if (limitedPartner.data) {
152+
limitedPartner.data.former_names = "john";
153+
}
154+
}
142155

143156
const res = await request(app)
144157
.post(URL)
145158
.send({
146159
pageType: PostTransitionPageType.addLimitedPartnerPerson,
160+
previousName: previousName,
147161
...limitedPartner.data
148162
});
149163

src/presentation/test/integration/registration/generalPartner/add-general-partner-person.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,15 @@ describe("Add General Partner Person Page", () => {
130130
});
131131

132132
describe("Post Add General Partner", () => {
133-
it("should send the general partner details", async () => {
133+
it.each([
134+
[ "true", "john" ],
135+
[ "false", "" ]
136+
])("should send the general partner details", async (previousName, formerNames) => {
134137
const res = await request(app).post(URL).send({
135138
pageType: RegistrationPageType.addGeneralPartnerPerson,
136-
forename: "test"
139+
forename: "test",
140+
previousName: previousName,
141+
former_names: formerNames
137142
});
138143

139144
expect(res.status).toBe(302);

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,15 @@ describe("Add Limited Partner Person Page", () => {
154154
});
155155

156156
describe("Post Add Limited Partner", () => {
157-
it("should send the Limited partner details", async () => {
157+
it.each([
158+
[ "true", "john" ],
159+
[ "false", "" ]
160+
])("should send the Limited partner details", async (previousName, formerNames) => {
158161
const res = await request(app).post(URL).send({
159162
pageType: RegistrationPageType.addLimitedPartnerPerson,
160-
forename: "test"
163+
forename: "test",
164+
previousName: previousName,
165+
former_names: formerNames
161166
});
162167

163168
expect(res.status).toBe(302);

src/presentation/test/integration/transition/generalPartner/add-general-partner-person.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@ describe("Add General Partner Person Page", () => {
126126
});
127127

128128
describe("Post Add General Partner", () => {
129-
it("should send the general partner details", async () => {
129+
it.each([
130+
[ "true", "john" ],
131+
[ "false", "" ]
132+
])("should send the general partner details", async (previousName, formerNames) => {
130133
const res = await request(app).post(URL).send({
131134
pageType: TransitionPageType.addGeneralPartnerPerson,
132-
forename: "test"
135+
forename: "test",
136+
previousName: previousName,
137+
former_names: formerNames
133138
});
134139

135140
expect(res.status).toBe(302);

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,15 @@ describe("Add Limited Partner Person Page", () => {
142142
});
143143

144144
describe("Post Add Limited Partner", () => {
145-
it("should send the Limited partner details", async () => {
145+
it.each([
146+
[ "true", "john" ],
147+
[ "false", "" ]
148+
])("should send the Limited partner details", async (previousName, formerNames) => {
146149
const res = await request(app).post(URL).send({
147150
pageType: TransitionPageType.addLimitedPartnerPerson,
148-
forename: "test"
151+
forename: "test",
152+
previousName: previousName,
153+
former_names: formerNames
149154
});
150155

151156
expect(res.status).toBe(302);

0 commit comments

Comments
 (0)