ajv/spec/v5.spec.js

44 lines
1023 B
JavaScript
Raw Normal View History

2015-11-28 17:59:08 +03:00
'use strict';
var jsonSchemaTest = require('json-schema-test')
2015-12-27 19:43:56 +03:00
, getAjvInstances = require('./ajv_instances')
, options = require('./ajv_options');
2015-11-28 17:59:08 +03:00
2015-12-27 19:43:56 +03:00
var instances = getAjvInstances(options, { v5: true });
2015-11-28 17:59:08 +03:00
jsonSchemaTest(instances, {
description: 'v5 schemas tests of ' + instances.length + ' ajv instances with different options',
suites: testSuites(),
2015-12-27 19:43:56 +03:00
assert: require('./chai').assert,
2015-11-28 17:59:08 +03:00
afterError: function (res) {
console.log('ajv options:', res.validator._opts);
2015-11-28 17:59:08 +03:00
},
// afterEach: function (res) {
// console.log(res.errors);
// },
2015-11-28 17:59:08 +03:00
cwd: __dirname,
hideFolder: 'v5/',
timeout: 90000
});
function testSuites() {
2016-07-28 02:50:30 +03:00
var suites;
2015-11-28 17:59:08 +03:00
if (typeof window == 'object') {
2016-07-28 02:50:30 +03:00
suites = {
2015-11-28 17:59:08 +03:00
'v5 proposals': require('./v5/{**/,}*.json', {mode: 'list'})
};
for (var suiteName in suites) {
suites[suiteName].forEach(function (suite) {
suite.test = suite.module;
});
}
} else {
2016-07-28 02:50:30 +03:00
suites = {
2015-11-28 17:59:08 +03:00
'v5 proposals': './v5/{**/,}*.json'
2016-07-28 02:50:30 +03:00
};
2015-11-28 17:59:08 +03:00
}
return suites;
}