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

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

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