Skip to content

Commit

Permalink
Adding schema and unit tests for form 10216
Browse files Browse the repository at this point in the history
  • Loading branch information
fatmakhan0395 committed Dec 9, 2024
1 parent 3a6965b commit 406d765
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/schemas/22-10216/schema.js
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;
22 changes: 22 additions & 0 deletions test/schemas/22-10216/schema.spec.js
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',
]);
});
});

0 comments on commit 406d765

Please sign in to comment.