diff --git a/src/schemas/22-10216/schema.js b/src/schemas/22-10216/schema.js new file mode 100644 index 00000000..61d8ea6d --- /dev/null +++ b/src/schemas/22-10216/schema.js @@ -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; diff --git a/test/schemas/22-10216/schema.spec.js b/test/schemas/22-10216/schema.spec.js new file mode 100644 index 00000000..682a6291 --- /dev/null +++ b/test/schemas/22-10216/schema.spec.js @@ -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', + ]); + }); +});