-
Notifications
You must be signed in to change notification settings - Fork 93
Description
New Address field accepts old address field values. Because of that we have outdated testcases, lacking validation and no visibility on if regression happened.
For example, advanced search was never updated to match the new format.
export const AddressFieldValue = z.object({
country: z.string(),
addressType: z.enum([AddressType.DOMESTIC, AddressType.INTERNATIONAL]),
administrativeArea: z
.string()
.uuid()
.optional() /* Leaf level admin structure */,
streetLevelDetails: StreetLevelDetailsValue
})
- administrativeArea is mandatory for DOMESTIC. Should not be provided for INTERNATIONAL
- API accepts arbitrary values within the object. It should strip out items outside of definition.
// Example test case
// packages/events/src/router/event/event.actions.declare.test.ts
const form = {
'applicant.address': {
country: 'FAR', <-- Only mandatory field
addressType: AddressType.DOMESTIC,
province: 'a45b982a-5c7b-4bd9-8fd8-a42d0994054c', <-- Old values are accepted
district: '5ef450bc-712d-48ad-93f3-8da0fa453baa', <-- Old values are accepted
urbanOrRural: 'RURAL' as const,
village: 'Small village'
// administrativeArea is missing
}
}
- Fix test cases to use new format.
Fix any other issues that come up and write appropriate test cases
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Completed