Skip to content

Conversation

@tomhalley
Copy link
Contributor

@tomhalley tomhalley commented Nov 17, 2025

Ticket: PAE-462
Ticket: PAE-463

This pull request updates several organisation fixture files and the organisation schema validation logic. The main focus is to improve the consistency and completeness of test data, particularly around registration and accreditation details, and to refine schema validation for nullable fields.

Fixture data improvements:

  • Added explicit registrationNumber, accreditationNumber, validFrom, and validTo fields (with appropriate values or null) to all registrations and accreditations in sample-organisation-1.json, sample-organisation-3.json, and sample-organisation-4.json for better data consistency and downstream test reliability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • For sample-organisation-2.json, populated registration and accreditation fields with realistic values, added new file upload fields, updated approved persons, and corrected orgId formatting for consistency with other fixtures. [1] [2] [3] [4] [5] [6] [7]

Schema validation logic:

  • Updated the organisation schema in schema.js to allow fields to be explicitly set to null when not required, improving flexibility for optional fields in test and production data.

General fixture corrections:

  • Fixed orgId formatting in sample-organisation-2.json and sample-organisation-4.json to use six digits for consistency. [1] [2]

Accreditation and registration completeness:

@tomhalley tomhalley changed the title PAE-462: Added schema validation to test the epr-organisation seed data PAE-463: Added schema validation to test the epr-organisation seed data Nov 17, 2025
@sonarqubecloud
Copy link

@tomhalley tomhalley marked this pull request as ready for review November 17, 2025 14:46
Copy link
Contributor

@nijk nijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@@ -0,0 +1,388 @@
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'fs'
import { join, dirname } from 'path'
Copy link
Contributor

@senthilinfy senthilinfy Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the utilities in validation.js to validate the seed data jsons? might be better to create a file named seed-data.test.js as schema validation tests are there in validation.test.js and contract tests.

Also validation.js is meant to be abstraction over the shema.js. The schema.test.js is accessing schema directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also consider inserting seed data through repository. that should fail validation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't realised we were still using the old way to importing the seed data. It feels like this is the thing to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants