Skip to content

Commit

Permalink
Tests for issue #40
Browse files Browse the repository at this point in the history
  • Loading branch information
zaggino committed Aug 20, 2014
1 parent c3b2df0 commit 805d00f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
74 changes: 74 additions & 0 deletions test/ZSchemaTestSuite/Issue40.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"use strict";

module.exports = {
description: "Issue #40 - validator ends up in infinite loop",
tests: [
{
description: "should pass validation",
schema: {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product set",
"is_start": "boolean",
"hierarchy": {
"$ref": "#/definitions/recursion"
},
"definitions": {
"recursion": {
"type": "object",
"additionalProperties": false,
"properties": {
"is_and": {
"type": "boolean"
},
"filters": {
"type": "array",
"additionalItems": false,
"items": {
"$ref": "#/definitions/recursion"
}
}
}
}
}
},
data: {
"is_start": true,
"hierarchy": {
"is_and": false,
"filters": [
{
"is_and": false,
"filters": [
{
"is_and": true,
"filters": [
{
"is_and": true,
"filters": [
{
"is_and": true,
"filters": [
{
"is_and": true,
"filters": [
{
"is_and": true,
"filters": []
}
]
}
]
}
]
}
]
}
]
}
]
}
},
valid: true
}
]
};
5 changes: 3 additions & 2 deletions test/spec/ZSchemaTestSuiteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var testSuiteFiles = [
require("../ZSchemaTestSuite/Issue25.js"),
require("../ZSchemaTestSuite/Issue26.js"),
require("../ZSchemaTestSuite/Issue37.js"),
require("../ZSchemaTestSuite/Issue40.js"),
undefined
];

Expand All @@ -38,8 +39,8 @@ describe("ZSchemaTestSuite", function () {
}
}

it("should contain 20 files", function () {
expect(testSuiteFiles.length).toBe(20);
it("should contain 21 files", function () {
expect(testSuiteFiles.length).toBe(21);
});

testSuiteFiles.forEach(function (testSuite) {
Expand Down

0 comments on commit 805d00f

Please sign in to comment.