Skip to content

Commit

Permalink
Fixed a failing test and cleaned up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshingYou1 committed Oct 2, 2023
1 parent dc56820 commit 839c753
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 120 deletions.
4 changes: 3 additions & 1 deletion src/common/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ const fullName = {

let hcaFullName = _.cloneDeep(fullName);
hcaFullName.properties.first.maxLength = 25;
hcaFullName.properties.last.maxLength = 35;
hcaFullName.properties.first.pattern = '^.*\\S.*';
hcaFullName.properties.middle.maxLength = 30;
hcaFullName.properties.last.minLength = 2;
hcaFullName.properties.last.maxLength = 35;
hcaFullName.properties.last.pattern = '^.*\\S.*';

const fullNameNoSuffix = {
type: 'object',
Expand Down
78 changes: 18 additions & 60 deletions src/schemas/10-10EZ/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ const schema = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'APPLICATION FOR HEALTH BENEFITS (10-10EZ)',
definitions: {
address: definitions.hcaAddress,
date: {
format: 'date',
type: 'string',
},
fullName: definitions.hcaFullName,
monetaryValue: definitions.hcaMonetaryValue,
phone: definitions.hcaPhone,
provider: definitions.insuranceProvider,
ssn: definitions.ssn,
},
type: 'object',
properties: {
Expand All @@ -33,9 +27,7 @@ const schema = {
mothersMaidenName: {
type: 'string',
},
veteranSocialSecurityNumber: {
$ref: '#/definitions/ssn',
},
veteranSocialSecurityNumber: definitions.ssn,
gender: {
type: 'string',
enum: constants.genders.map(option => option.value),
Expand Down Expand Up @@ -90,26 +82,16 @@ const schema = {
hasDemographicNoAnswer: {
type: 'boolean',
},
veteranAddress: {
$ref: '#/definitions/address',
},
veteranHomeAddress: {
$ref: '#/definitions/address',
},
veteranAddress: definitions.hcaAddress,
veteranHomeAddress: definitions.hcaAddress,
email: definitions.hcaEmail,
homePhone: {
$ref: '#/definitions/phone',
},
mobilePhone: {
$ref: '#/definitions/phone',
},
homePhone: definitions.hcaPhone,
mobilePhone: definitions.hcaPhone,
discloseFinancialInformation: {
type: 'boolean',
},
spouseFullName: definitions.hcaFullName,
spouseSocialSecurityNumber: {
$ref: '#/definitions/ssn',
},
spouseSocialSecurityNumber: definitions.ssn,
spouseDateOfBirth: {
$ref: '#/definitions/date',
},
Expand All @@ -126,48 +108,24 @@ const schema = {
provideSupportLastYear: {
type: 'boolean',
},
spouseAddress: {
$ref: '#/definitions/address',
},
spousePhone: {
$ref: '#/definitions/phone',
},
spouseAddress: definitions.hcaAddress,
spousePhone: definitions.hcaPhone,
dependents: definitions.hcaDependents,
veteranGrossIncome: {
$ref: '#/definitions/monetaryValue',
},
veteranNetIncome: {
$ref: '#/definitions/monetaryValue',
},
veteranOtherIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseGrossIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseNetIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseOtherIncome: {
$ref: '#/definitions/monetaryValue',
},
deductibleMedicalExpenses: {
$ref: '#/definitions/monetaryValue',
},
deductibleFuneralExpenses: {
$ref: '#/definitions/monetaryValue',
},
deductibleEducationExpenses: {
$ref: '#/definitions/monetaryValue',
},
veteranGrossIncome: definitions.hcaMonetaryValue,
veteranNetIncome: definitions.hcaMonetaryValue,
veteranOtherIncome: definitions.hcaMonetaryValue,
spouseGrossIncome: definitions.hcaMonetaryValue,
spouseNetIncome: definitions.hcaMonetaryValue,
spouseOtherIncome: definitions.hcaMonetaryValue,
deductibleMedicalExpenses: definitions.hcaMonetaryValue,
deductibleFuneralExpenses: definitions.hcaMonetaryValue,
deductibleEducationExpenses: definitions.hcaMonetaryValue,
isCoveredByHealthInsurance: {
type: 'boolean',
},
providers: {
type: 'array',
items: {
$ref: '#/definitions/provider',
},
items: definitions.insuranceProvider,
},
isMedicaidEligible: {
type: 'boolean',
Expand Down
77 changes: 18 additions & 59 deletions src/schemas/10-10EZR/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@ const schema = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'HEALTH BENEFITS UPDATE FORM (10-10EZR)',
definitions: {
monetaryValue: definitions.hcaMonetaryValue,
ssn: definitions.ssn,
date: {
format: 'date',
type: 'string',
},
phone: definitions.hcaPhone,
provider: definitions.insuranceProvider,
address: definitions.hcaAddress,
},
type: 'object',
properties: {
veteranFullName: definitions.hcaFullName,
veteranSocialSecurityNumber: {
$ref: '#/definitions/ssn',
},
veteranSocialSecurityNumber: definitions.ssn,
preferredName: { type: 'string' },
gender: {
type: 'string',
Expand All @@ -31,18 +24,10 @@ const schema = {
veteranDateOfBirth: {
$ref: '#/definitions/date',
},
homePhone: {
$ref: '#/definitions/phone',
},
mobilePhone: {
$ref: '#/definitions/phone',
},
veteranAddress: {
$ref: '#/definitions/address',
},
veteranHomeAddress: {
$ref: '#/definitions/address',
},
homePhone: definitions.hcaPhone,
mobilePhone: definitions.hcaPhone,
veteranAddress: definitions.hcaAddress,
veteranHomeAddress: definitions.hcaAddress,
email: definitions.hcaEmail,
maritalStatus: definitions.maritalStatus,
isEssentialAcaCoverage: {
Expand All @@ -57,9 +42,7 @@ const schema = {
},
providers: {
type: 'array',
items: {
$ref: '#/definitions/provider',
},
items: definitions.insuranceProvider,
},
isMedicaidEligible: {
type: 'boolean',
Expand All @@ -83,9 +66,7 @@ const schema = {
},
dischargeType: definitions.dischargeType,
spouseFullName: definitions.hcaFullName,
spouseSocialSecurityNumber: {
$ref: '#/definitions/ssn',
},
spouseSocialSecurityNumber: definitions.ssn,
spouseDateOfBirth: {
$ref: '#/definitions/date',
},
Expand All @@ -99,40 +80,18 @@ const schema = {
provideSupportLastYear: {
type: 'boolean',
},
spouseAddress: {
$ref: '#/definitions/address',
},
spousePhone: {
$ref: '#/definitions/phone',
},
spouseAddress: definitions.hcaAddress,
spousePhone: definitions.hcaPhone,
dependents: definitions.hcaDependents,
veteranGrossIncome: {
$ref: '#/definitions/monetaryValue',
},
veteranNetIncome: {
$ref: '#/definitions/monetaryValue',
},
veteranOtherIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseGrossIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseNetIncome: {
$ref: '#/definitions/monetaryValue',
},
spouseOtherIncome: {
$ref: '#/definitions/monetaryValue',
},
deductibleMedicalExpenses: {
$ref: '#/definitions/monetaryValue',
},
deductibleFuneralExpenses: {
$ref: '#/definitions/monetaryValue',
},
deductibleEducationExpenses: {
$ref: '#/definitions/monetaryValue',
},
veteranGrossIncome: definitions.hcaMonetaryValue,
veteranNetIncome: definitions.hcaMonetaryValue,
veteranOtherIncome: definitions.hcaMonetaryValue,
spouseGrossIncome: definitions.hcaMonetaryValue,
spouseNetIncome: definitions.hcaMonetaryValue,
spouseOtherIncome: definitions.hcaMonetaryValue,
deductibleMedicalExpenses: definitions.hcaMonetaryValue,
deductibleFuneralExpenses: definitions.hcaMonetaryValue,
deductibleEducationExpenses: definitions.hcaMonetaryValue,
privacyAgreementAccepted: {
type: 'boolean',
enum: [true],
Expand Down
1 change: 1 addition & 0 deletions test/schemas/10-10EZ/schema.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ajv from 'ajv';
import { omit } from 'lodash';
import { expect } from 'chai';
import { it } from 'mocha';
import schemas from '../../../dist/schemas';
import SchemaTestHelper from '../../support/schema-test-helper';

Expand Down

0 comments on commit 839c753

Please sign in to comment.