Skip to content

Commit 29c6003

Browse files
committed
test(V2): restore reference-guard error-message assertions
The 409 reference-conflict response still returns error: 'Referenced records must be removed before deletion' via buildReferenceConflictBody, so these assertions pin a real contract. Restore them in the label, methodology, program, and stakeholder reference-guard tests to recover the lost coverage.
1 parent bf7c07b commit 29c6003

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

tests/v2/integration/label-v2.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ describe('Label V2 Endpoint Integration Tests', function () {
652652
expect(response.body.references).to.be.an('array').with.lengthOf(1);
653653
expect(response.body.references[0].table).to.equal('unit_label');
654654
expect(response.body.references[0].count).to.equal(1);
655+
expect(response.body.error).to.equal('Referenced records must be removed before deletion');
655656

656657
const stagingRecord = await StagingV2.findOne({
657658
where: { table: 'label', action: 'DELETE' },

tests/v2/integration/methodology-v2.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ describe('V2 Methodology API - Basic CRUD Tests', function () {
444444
expect(response.body.references).to.be.an('array').with.lengthOf(1);
445445
expect(response.body.references[0].table).to.equal('project_methodology');
446446
expect(response.body.references[0].count).to.equal(1);
447+
expect(response.body.error).to.equal('Referenced records must be removed before deletion');
447448

448449
const stagingRecord = await StagingV2.findOne({
449450
where: { table: 'methodology', action: 'DELETE' },

tests/v2/integration/program-v2.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ describe('V2 Program API - Basic CRUD Tests', function () {
463463
expect(response.body.references).to.be.an('array').with.lengthOf(1);
464464
expect(response.body.references[0].table).to.equal('project');
465465
expect(response.body.references[0].count).to.equal(1);
466+
expect(response.body.error).to.equal('Referenced records must be removed before deletion');
466467

467468
const stagingRecord = await StagingV2.findOne({
468469
where: { table: 'program', action: 'DELETE' },

tests/v2/integration/stakeholder-v2.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ describe('Stakeholder V2 Endpoint Integration Tests', function () {
564564
expect(response.body.references).to.be.an('array').with.lengthOf(1);
565565
expect(response.body.references[0].table).to.equal('stakeholder_projects');
566566
expect(response.body.references[0].count).to.equal(1);
567+
expect(response.body.error).to.equal('Referenced records must be removed before deletion');
567568

568569
const stagingRecord = await StagingV2.findOne({
569570
where: { table: 'stakeholder', action: 'DELETE' },

0 commit comments

Comments
 (0)