UNPKG

@dvsa/smc-encounter-schema

Version:

Schemas required for Encounter submission as well as custom validators ## Developing ### Pre-requisites

21 lines (18 loc) 794 B
import { EncounterSchema } from '../../index'; import * as MissingMandatory from '../__mocks__/invalid/missing-mandatory.json'; import * as CompleteEncounter from '../__mocks__/valid/complete-encounter.json'; describe('Encounter Schema Tests', () => { describe('Valid encounters', () => { it('should return 0 errors for a valid encounter', async () => { const encounterSchema = new EncounterSchema(CompleteEncounter); expect(await encounterSchema.validate()).toHaveLength(0); }); }); describe('Invalid encounters', () => { it('should return errors for an invalid encounter', async () => { const encounterSchema = new EncounterSchema(MissingMandatory); const validationErrors = await encounterSchema.validate(); expect(validationErrors).toHaveLength(1); }); }); });