test: fix browser tests, replace id with $id
parent
85839c278d
commit
dad7132adf
|
@ -27,8 +27,8 @@ describe('Ajv', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should cache compiled functions for the same schema', function() {
|
it('should cache compiled functions for the same schema', function() {
|
||||||
var v1 = ajv.compile({ id: '//e.com/int.json', type: 'integer', minimum: 1 });
|
var v1 = ajv.compile({ $id: '//e.com/int.json', type: 'integer', minimum: 1 });
|
||||||
var v2 = ajv.compile({ id: '//e.com/int.json', minimum: 1, type: 'integer' });
|
var v2 = ajv.compile({ $id: '//e.com/int.json', minimum: 1, type: 'integer' });
|
||||||
v1 .should.equal(v2);
|
v1 .should.equal(v2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ describe('compileAsync method', function() {
|
||||||
|
|
||||||
it('if loadSchema returned error', function() {
|
it('if loadSchema returned error', function() {
|
||||||
var schema = {
|
var schema = {
|
||||||
"id": "http://example.com/parent.json",
|
"$id": "http://example.com/parent.json",
|
||||||
"properties": {
|
"properties": {
|
||||||
"a": { "$ref": "object.json" }
|
"a": { "$ref": "object.json" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
module.exports = function (suite) {
|
module.exports = function (suite) {
|
||||||
suite.forEach(function (file) {
|
suite.forEach(function (file) {
|
||||||
|
if (file.name.indexOf('optional/format') == 0)
|
||||||
|
file.name = file.name.replace('optional/', '');
|
||||||
file.test = file.module;
|
file.test = file.module;
|
||||||
});
|
});
|
||||||
return suite;
|
return suite;
|
||||||
|
|
|
@ -410,7 +410,7 @@ describe('Validation errors', function () {
|
||||||
|
|
||||||
it('"items" errors should include item index without quotes in dataPath (#48)', function() {
|
it('"items" errors should include item index without quotes in dataPath (#48)', function() {
|
||||||
var schema1 = {
|
var schema1 = {
|
||||||
id: 'schema1',
|
$id: 'schema1',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: {
|
items: {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
|
@ -445,7 +445,7 @@ describe('Validation errors', function () {
|
||||||
shouldBeError(fullValidate.errors[1], 'minimum', '#/items/minimum', '/3', 'should be >= 10');
|
shouldBeError(fullValidate.errors[1], 'minimum', '#/items/minimum', '/3', 'should be >= 10');
|
||||||
|
|
||||||
var schema2 = {
|
var schema2 = {
|
||||||
id: 'schema2',
|
$id: 'schema2',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: [{ minimum: 10 }, { minimum: 9 }, { minimum: 12 }]
|
items: [{ minimum: 10 }, { minimum: 9 }, { minimum: 12 }]
|
||||||
};
|
};
|
||||||
|
|
|
@ -1153,7 +1153,9 @@ describe('Ajv Options', function () {
|
||||||
|
|
||||||
describe('= "id"', function() {
|
describe('= "id"', function() {
|
||||||
it('should use id and ignore $id', function() {
|
it('should use id and ignore $id', function() {
|
||||||
var ajv = new Ajv({schemaId: 'id'});
|
var ajv = new Ajv({schemaId: 'id', meta: false});
|
||||||
|
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
|
||||||
|
ajv._opts.defaultMeta = 'http://json-schema.org/draft-04/schema#';
|
||||||
|
|
||||||
ajv.addSchema({ id: 'mySchema1', type: 'string' });
|
ajv.addSchema({ id: 'mySchema1', type: 'string' });
|
||||||
var validate = ajv.getSchema('mySchema1');
|
var validate = ajv.getSchema('mySchema1');
|
||||||
|
|
|
@ -56,9 +56,9 @@
|
||||||
{
|
{
|
||||||
"description": "if keyword with id in sibling subschema",
|
"description": "if keyword with id in sibling subschema",
|
||||||
"schema": {
|
"schema": {
|
||||||
"id": "http://example.com/base_if",
|
"$id": "http://example.com/base_if",
|
||||||
"if": {
|
"if": {
|
||||||
"id": "http://example.com/if",
|
"$id": "http://example.com/if",
|
||||||
"minimum": 10
|
"minimum": 10
|
||||||
},
|
},
|
||||||
"then": { "$ref": "#/definitions/def" },
|
"then": { "$ref": "#/definitions/def" },
|
||||||
|
|
Loading…
Reference in New Issue