source: imaps-frontend/node_modules/fast-uri/test/ajv.test.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 737 bytes
Line 
1const AJV = require('ajv')
2const fastUri = require('../')
3const ajv = new AJV({
4 uriResolver: fastUri // comment this line to see it works with uri-js
5})
6const test = require('tape')
7
8test('ajv', t => {
9 t.plan(1)
10 const schema = {
11 $ref: '#/definitions/Record%3Cstring%2CPerson%3E',
12 definitions: {
13 Person: {
14 type: 'object',
15 properties: {
16 firstName: {
17 type: 'string'
18 }
19 }
20 },
21 'Record<string,Person>': {
22 type: 'object',
23 additionalProperties: {
24 $ref: '#/definitions/Person'
25 }
26 }
27 }
28 }
29
30 const data = {
31 joe: {
32 firstName: 'Joe'
33 }
34
35 }
36
37 const validate = ajv.compile(schema)
38 t.ok(validate(data))
39})
Note: See TracBrowser for help on using the repository browser.