Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81155 views
1
var tape = require('tape')
2
var fs = require('fs')
3
var validator = require('../')
4
5
var files = fs.readdirSync(__dirname+'/json-schema-draft4')
6
.map(function(file) {
7
if (file === 'definitions.json') return null
8
if (file === 'refRemote.json') return null
9
return require('./json-schema-draft4/'+file)
10
})
11
.filter(Boolean)
12
13
files.forEach(function(file) {
14
file.forEach(function(f) {
15
tape('json-schema-test-suite '+f.description, function(t) {
16
var validate = validator(f.schema)
17
f.tests.forEach(function(test) {
18
t.same(validate(test.data), test.valid, test.description)
19
})
20
t.end()
21
})
22
})
23
})
24
25