-
Notifications
You must be signed in to change notification settings - Fork 2
PAE-463: Added schema validation to test the epr-organisation seed data #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…' of github.com:DEFRA/epr-backend into PAE-462-seed-data-validation
|
nijk
left a comment
There was a problem hiding this 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' | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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



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, andvalidTofields (with appropriate values ornull) to all registrations and accreditations insample-organisation-1.json,sample-organisation-3.json, andsample-organisation-4.jsonfor 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 correctedorgIdformatting for consistency with other fixtures. [1] [2] [3] [4] [5] [6] [7]Schema validation logic:
schema.jsto allow fields to be explicitly set tonullwhen not required, improving flexibility for optional fields in test and production data.General fixture corrections:
orgIdformatting insample-organisation-2.jsonandsample-organisation-4.jsonto use six digits for consistency. [1] [2]Accreditation and registration completeness: