test: add JSON-Schema-Test-Suite draft-07 tests

master
Evgeny Poberezkin 2017-12-02 13:25:19 +00:00
parent 42cfcf9c42
commit 846e080c17
1 changed files with 13 additions and 12 deletions

View File

@ -13,14 +13,24 @@ var remoteRefs = {
'http://localhost:1234/name.json': require('./JSON-Schema-Test-Suite/remotes/name.json')
};
var SKIP = {
4: ['optional/zeroTerminatedFloats'],
7: ['optional/content', 'optional/format']
};
runTest(getAjvInstances(options, {meta: false, schemaId: 'id'}), 4, typeof window == 'object'
? suite(require('./JSON-Schema-Test-Suite/tests/draft4/{**/,}*.json', {mode: 'list'}))
: './JSON-Schema-Test-Suite/tests/draft4/{**/,}*.json');
runTest(getAjvInstances(options, {meta: false, schemaId: 'auto', format: 'full'}), 6, typeof window == 'object'
runTest(getAjvInstances(options, {meta: false, format: 'full'}), 6, typeof window == 'object'
? suite(require('./JSON-Schema-Test-Suite/tests/draft6/{**/,}*.json', {mode: 'list'}))
: './JSON-Schema-Test-Suite/tests/draft6/{**/,}*.json');
runTest(getAjvInstances(options, {format: 'full'}), 7, typeof window == 'object'
? suite(require('./JSON-Schema-Test-Suite/tests/draft7/{**/,}*.json', {mode: 'list'}))
: './JSON-Schema-Test-Suite/tests/draft7/{**/,}*.json');
function runTest(instances, draft, tests) {
instances.forEach(function (ajv) {
@ -40,17 +50,8 @@ function runTest(instances, draft, tests) {
jsonSchemaTest(instances, {
description: 'JSON-Schema Test Suite draft-0' + draft + ': ' + instances.length + ' ajv instances with different options',
suites: {tests: tests},
only: [
// 'type', 'not', 'allOf', 'anyOf', 'oneOf', 'enum',
// 'maximum', 'minimum', 'multipleOf', 'maxLength', 'minLength', 'pattern',
// 'properties', 'patternProperties', 'additionalProperties',
// 'dependencies', 'required',
// 'maxProperties', 'minProperties', 'maxItems', 'minItems',
// 'items', 'additionalItems', 'uniqueItems',
// 'optional/format', 'optional/bignum',
// 'ref', 'refRemote', 'definitions',
],
skip: ['optional/zeroTerminatedFloats'],
only: [],
skip: SKIP[draft],
assert: require('./chai').assert,
afterError: after.error,
afterEach: after.each,