-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding schema and unit tests for form 10216
- Loading branch information
1 parent
3a6965b
commit 406d765
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import _ from 'lodash'; | ||
import definitions from '../../common/definitions'; | ||
|
||
const origDefinitions = _.cloneDeep(definitions); | ||
|
||
const schema = { | ||
$schema: 'http://json-schema.org/draft-04/schema#', | ||
title: '22-10216 5% EXEMPTION REQUEST FROM 85/15 REPORTING REQUIREMENT GENERAL INFORMATION (22-10216)', | ||
type: 'object', | ||
additionalProperties: false, | ||
definitions: origDefinitions, | ||
properties: { | ||
institutionDetails: { | ||
type: 'object', | ||
required: ['institutionName', 'facilityCode', 'termStartDate'], | ||
properties: { | ||
institutionName: { | ||
type: 'string', | ||
}, | ||
facilityCode: { | ||
type: 'string', | ||
}, | ||
termStartDate: { | ||
$ref: '#/definitions/date', | ||
}, | ||
dateOfCalculations: { | ||
$ref: '#/definitions/date', | ||
}, | ||
}, | ||
}, | ||
studentRatioCalcChapter: { | ||
type: 'object', | ||
required: ['beneficiaryStudent', 'numOfStudent', 'dateOfCalculation'], | ||
properties: { | ||
beneficiaryStudent: { | ||
type: 'number', | ||
}, | ||
numOfStudent: { | ||
type: 'number', | ||
}, | ||
dateOfCalculation: { | ||
$ref: '#/definitions/date', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default schema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { expect } from 'chai'; | ||
import { it } from 'mocha'; | ||
import { cloneDeep } from 'lodash'; | ||
import schema from '../../../src/schemas/22-10216/schema'; | ||
|
||
const schemaWithoutRequired = cloneDeep(schema); | ||
delete schemaWithoutRequired.required; | ||
|
||
describe('10216 schema', () => { | ||
it('should have required fields', () => { | ||
expect(schema.properties.institutionDetails.required).to.deep.equal([ | ||
'institutionName', | ||
'facilityCode', | ||
'termStartDate', | ||
]); | ||
expect(schema.properties.studentRatioCalcChapter.required).to.deep.equal([ | ||
'beneficiaryStudent', | ||
'numOfStudent', | ||
'dateOfCalculation', | ||
]); | ||
}); | ||
}); |