Skip to content

Commit

Permalink
#VYE-134 #comment schema for direct deposit is complete with tests pa…
Browse files Browse the repository at this point in the history
…ssing
  • Loading branch information
jsimonVA committed Nov 25, 2023
1 parent c14ab94 commit e89a2b6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
6 changes: 3 additions & 3 deletions dist/VYE-DIRECT-DEPOSIT-CHANGE-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
}
},
"properties": {
"bankAccount": {
"$ref": "#/definitions/bankAccount"
},
"checkDigit": {
"type": "string"
},
"bankName": {
"type": "string"
},
"bankAccount": {
"$ref": "#/definitions/bankAccount"
},
"bankPhone": {
"$ref": "#/definitions/usaPhone"
}
Expand Down
23 changes: 11 additions & 12 deletions src/schemas/VYE-Direct-Deposit-Change/schema.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import _ from 'lodash';
import definitions from '../../common/definitions';

import schemaHelpers from '../../common/schema-helpers';

const schema = {
$schema: 'http://json-schema.org/draft-04/schema#',
title: 'VERIFY YOUR ENROLLMENT CHANGE OF DIRECT DEPOSIT',
type: 'object',
additionalProperties: false,
definitions:_.merge(
_.pick(definitions,['bankAccount','usaPhone'])
),
definitions:{},
properties: {
bankAccount: {
$ref: '#/definitions/bankAccount',
},

checkDigit: {
type: 'string',
},
bankName:{
type:'string'
},
bankPhone:{
$ref: '#/definitions/usaPhone',
},
},
required: ['bankName', 'bankAccount', 'bankPhone',],
};

[
['bankAccount'],
['usaPhone', 'bankPhone'],
].forEach(args => {
schemaHelpers.addDefinitionToSchema(schema, ...args);
});

export default schema;
21 changes: 14 additions & 7 deletions test/schemas/VYE-Direct-Deposit-Change/schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ import SharedTests from '../../support/shared-tests';

const schema = schemas['VYE-DIRECT-DEPOSIT-CHANGE'];

let schemaTestHelper = new SchemaTestHelper(schema);
let sharedTests = new SharedTests(schemaTestHelper);
const schemaTestHelper = new SchemaTestHelper(schema,{
bankName: "Test Name",
bankAccount: { accountType: 'checking', routingNumber: '123123123', accountNumber: '1234' },
bankPhone: '1231231231',
});

const sharedTests = new SharedTests(schemaTestHelper);


describe('VYE direct deposit change', () => {
[
'bankAccount',
'usaPhone'
].forEach((test) => {
sharedTests.runTest(test);
sharedTests.runTest('bankAccount', ['bankAccount']);
sharedTests.runTest('usaPhone', ['bankPhone'])

schemaTestHelper.testValidAndInvalid('bankName', {
valid: ['Test Name'],
invalid: [234],
});
});

0 comments on commit e89a2b6

Please sign in to comment.