From 37ed578b69e09a62ff70426f0906d5bffaea4c0a Mon Sep 17 00:00:00 2001 From: Christine <127446042+christinec-fftc@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:52:33 -0700 Subject: [PATCH] 58745 Switch to optional fields for va-medical-records page --- dist/21-526EZ-ALLCLAIMS-schema.json | 11 ++-------- src/schemas/21-526EZ-allclaims/schema.js | 6 ++---- test/schemas/21-526EZ/schema.spec.js | 26 ++++++++++++++++-------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/dist/21-526EZ-ALLCLAIMS-schema.json b/dist/21-526EZ-ALLCLAIMS-schema.json index 63ef4a07d..885f1a8fa 100644 --- a/dist/21-526EZ-ALLCLAIMS-schema.json +++ b/dist/21-526EZ-ALLCLAIMS-schema.json @@ -496,9 +496,6 @@ }, "vaTreatmentCenterAddress": { "type": "object", - "required": [ - "country" - ], "properties": { "country": { "$ref": "#/definitions/country" @@ -987,14 +984,10 @@ }, "vaTreatmentFacilities": { "type": "array", - "minItems": 1, + "minItems": 0, "maxItems": 100, "items": { "type": "object", - "required": [ - "treatmentCenterName", - "treatedDisabilityNames" - ], "properties": { "treatmentCenterName": { "type": "string", @@ -1009,7 +1002,7 @@ }, "treatedDisabilityNames": { "type": "array", - "minItems": 1, + "minItems": 0, "maxItems": 100, "items": { "type": "string" diff --git a/src/schemas/21-526EZ-allclaims/schema.js b/src/schemas/21-526EZ-allclaims/schema.js index 72bd5fca2..c8cec1ed6 100644 --- a/src/schemas/21-526EZ-allclaims/schema.js +++ b/src/schemas/21-526EZ-allclaims/schema.js @@ -71,7 +71,6 @@ const vaTreatmentCenterAddressDef = (addressSchema => { const { type, properties } = addressSchema; return { type, - required: ['country'], properties: _.pick(['country', 'city', 'state'], properties), }; })(baseAddressDef); @@ -455,11 +454,10 @@ const schema = { }, vaTreatmentFacilities: { type: 'array', - minItems: 1, + minItems: 0, maxItems: 100, items: { type: 'object', - required: ['treatmentCenterName', 'treatedDisabilityNames'], properties: { treatmentCenterName: { type: 'string', @@ -474,7 +472,7 @@ const schema = { }, treatedDisabilityNames: { type: 'array', - minItems: 1, + minItems: 0, maxItems: 100, items: { type: 'string', diff --git a/test/schemas/21-526EZ/schema.spec.js b/test/schemas/21-526EZ/schema.spec.js index e9a4c68cf..2329db58f 100644 --- a/test/schemas/21-526EZ/schema.spec.js +++ b/test/schemas/21-526EZ/schema.spec.js @@ -302,14 +302,8 @@ const data = { ], }, vaTreatmentCenterAddress: { - valid: [{ country: 'USA' }, { country: 'Spain', city: 'abc' }, { country: 'Spain', city: 'xyz', state: 'AL' }], - invalid: [ - {}, - { country: 'XYZ' }, - { country: 'Spain', state: 'AB' }, - { state: 'AL' }, - { country: 'USA', city: 1234 }, - ], + valid: [{}, { country: 'USA' }, { country: 'Spain', city: 'abc' }, { country: 'Spain', city: 'xyz', state: 'AL' }], + invalid: [{ country: 'XYZ' }, { country: 'Spain', state: 'AB' }, { country: 'USA', city: 1234 }], }, homelessOrAtRisk: { valid: ['no', 'homeless', 'atRisk'], @@ -335,8 +329,22 @@ const data = { vaTreatmentCenterAddress: { country: 'USA' }, }, ], + [][{}], + ], + invalid: [ + { + treatmentCenterName: makeString(100, 'abc123'), + treatedDisabilityNames: ['xyz'], + treatmentDateRange: fixtures.dateRange, + vaTreatmentCenterAddress: { country: 'nowhere' }, + }, + { + treatmentCenterName: makeString(100, 'abc123'), + treatedDisabilityNames: ['xyz'], + treatmentDateRange: fixtures.dateRange, + vaTreatmentCenterAddress: { state: 'nope' }, + }, ], - invalid: [[], [{}], [{ treatmentCenterName: 1234 }], [{ treatmentCenterName: 'foo', treatedDisabilityNames: [] }]], }, bankAccountType: { valid: ['Checking', 'Savings'],