|
145 | 145 | "exec": [ |
146 | 146 | "pm.test('Status is 201', () => pm.response.to.have.status(201));", |
147 | 147 | "const json = pm.response.json();", |
148 | | - "pm.test('Created 1 CR (add_member_4ps)', () => pm.expect(json.changeRequestCount).to.equal(1));", |
| 148 | + "pm.test('Exactly 1 CR is created (no separate solo-parent auto-CR)', () => pm.expect(json.changeRequestCount).to.equal(1));", |
149 | 149 | "const addCR = json.changeRequests.find(cr => cr.requestType.code === 'add_member_4ps');", |
150 | 150 | "pm.test('Has add_member_4ps CR', () => pm.expect(addCR).to.not.be.undefined);", |
151 | 151 | "pm.test('Is newborn', () => pm.expect(addCR.detail.is_newborn_child).to.be.true);", |
| 152 | + "pm.test('Add Member CR is the only CR (apply directly updates parent)', () => {", |
| 153 | + " const updateInd = json.changeRequests.find(cr => cr.requestType.code === 'update_individual_4ps');", |
| 154 | + " pm.expect(updateInd, 'no update_individual_4ps CR should be auto-created').to.be.undefined;", |
| 155 | + "});", |
152 | 156 | "console.log('Ticket:', json.ticketNumber, '| CRs:', json.changeRequestCount);" |
153 | 157 | ] |
154 | 158 | } |
|
173 | 177 | } |
174 | 178 | } |
175 | 179 | }, |
| 180 | + { |
| 181 | + "name": "Add Newborn — conflicting solo parent (422)", |
| 182 | + "event": [ |
| 183 | + { |
| 184 | + "listen": "test", |
| 185 | + "script": { |
| 186 | + "type": "text/javascript", |
| 187 | + "exec": [ |
| 188 | + "pm.test('Status is 422', () => pm.response.to.have.status(422));", |
| 189 | + "const json = pm.response.json();", |
| 190 | + "pm.test('Error mentions conflicting isSoloParent', () => {", |
| 191 | + " const detail = (json.detail || json.message || '').toString();", |
| 192 | + " pm.expect(detail.toLowerCase()).to.include('conflict');", |
| 193 | + "});", |
| 194 | + "pm.test('Error names the disputed memberId4ps', () => {", |
| 195 | + " const detail = (json.detail || json.message || '').toString();", |
| 196 | + " pm.expect(detail).to.include('1101463');", |
| 197 | + "});" |
| 198 | + ] |
| 199 | + } |
| 200 | + } |
| 201 | + ], |
| 202 | + "request": { |
| 203 | + "method": "POST", |
| 204 | + "header": [], |
| 205 | + "body": { |
| 206 | + "mode": "raw", |
| 207 | + "raw": "{\n \"listahananId\": \"716649470-0-43202834\",\n \"autoSubmit\": false,\n \"description\": \"Conflict: newborn relationship says parent 1101463 is solo, memberList says they are not\",\n \"addMembers\": [\n {\n \"givenName\": \"Baby\",\n \"familyName\": \"AQUINO\",\n \"birthdate\": \"2026-03-01\",\n \"gender\": {\n \"system\": \"urn:iso:std:iso:5218\",\n \"code\": \"2\"\n },\n \"relationshipToHead\": {\n \"system\": \"urn:openspp:vocab:relationship\",\n \"code\": \"grandchild\"\n },\n \"isNewbornChild\": true,\n \"hasNoParents\": false,\n \"parentRelationships\": [\n {\n \"member\": {\n \"memberId4ps\": \"1101463\"\n },\n \"relationship\": {\n \"system\": \"urn:openspp:vocab:relationship\",\n \"code\": \"parent\"\n },\n \"isSoloParent\": true\n }\n ]\n }\n ],\n \"memberList\": [\n {\n \"memberId4ps\": \"1101463\",\n \"isSoloParent\": false\n }\n ]\n}", |
| 208 | + "options": { |
| 209 | + "raw": { |
| 210 | + "language": "json" |
| 211 | + } |
| 212 | + } |
| 213 | + }, |
| 214 | + "url": { |
| 215 | + "raw": "{{api_base}}/4ps/ChangesSubmission", |
| 216 | + "host": ["{{api_base}}"], |
| 217 | + "path": ["4ps", "ChangesSubmission"] |
| 218 | + } |
| 219 | + } |
| 220 | + }, |
176 | 221 | { |
177 | 222 | "name": "Delist Household (Reset for Reinstatement Test)", |
178 | 223 | "event": [ |
|
0 commit comments