Skip to content

Instantly share code, notes, and snippets.

@ruswerner
Created March 26, 2020 23:58
Show Gist options
  • Select an option

  • Save ruswerner/726755f7b951890c0e49b970335e0113 to your computer and use it in GitHub Desktop.

Select an option

Save ruswerner/726755f7b951890c0e49b970335e0113 to your computer and use it in GitHub Desktop.
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