Created
March 26, 2020 23:58
-
-
Save ruswerner/726755f7b951890c0e49b970335e0113 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import {cardLayoutSchema} from '@shared/components/card/schema'; | |
| import Ajv from 'ajv'; | |
| describe('schema', () => { | |
| const ajv = new Ajv(); | |
| it('should validate', () => { | |
| const photoScheduleLayout = { | |
| blocks: [ | |
| {type: 'image', field: 'imageUri'}, | |
| {type: 'section', fields: ['name']}, | |
| {type: 'section', fields: ['startDate', 'endDate'], style: 'range'}, | |
| {type: 'comments'} | |
| ] | |
| }; | |
| const validate = ajv.compile(cardLayoutSchema); | |
| validate(photoScheduleLayout); | |
| expect(validate.errors).toBeFalsy(); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment