Skip to content

Commit b6834e1

Browse files
committed
Copied testcase for issue #22
1 parent 5d09882 commit b6834e1

File tree

4 files changed

+84
-8
lines changed

4 files changed

+84
-8
lines changed

Diff for: bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "z-schema",
33
"version": "3.0.0",
44
"description": "JSON schema validator",
5-
"homepage": "https://github.com/zaggino/z-schema-3",
5+
"homepage": "https://github.com/zaggino/z-schema",
66
"authors": [
77
"Martin Zagora <[email protected]>"
88
],

Diff for: package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "z-schema",
33
"version": "3.0.0",
44
"description": "JSON schema validator",
5-
"homepage": "https://github.com/zaggino/z-schema-3",
5+
"homepage": "https://github.com/zaggino/z-schema",
66
"authors": [
77
"Martin Zagora <[email protected]>"
88
],
@@ -14,14 +14,15 @@
1414
],
1515
"repository": {
1616
"type": "git",
17-
"url": "https://github.com/zaggino/z-schema-3.git"
17+
"url": "https://github.com/zaggino/z-schema.git"
1818
},
1919
"bugs": {
20-
"url": "https://github.com/zaggino/z-schema-3/issues"
20+
"url": "https://github.com/zaggino/z-schema/issues"
2121
},
2222
"main": "src/ZSchema.js",
2323
"files": [
24-
"src/ZSchema.js",
24+
"src",
25+
"dist",
2526
"LICENSE",
2627
"README.md"
2728
],

Diff for: test/ZSchemaTestSuite/Issue22.js

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"use strict";
2+
3+
module.exports = {
4+
description: "Issue #22",
5+
tests: [
6+
{
7+
description: "should pass validation",
8+
schema: {
9+
type: "object",
10+
additionalProperties: false,
11+
properties: {
12+
"is_and": { type: "boolean" },
13+
"filters": {
14+
type: "array",
15+
additionalItems: false,
16+
items: {
17+
oneOf: [
18+
{ $ref: "#" },
19+
{ $ref: "#/definitions/last" }
20+
]
21+
}
22+
}
23+
},
24+
definitions: {
25+
"last": {
26+
type: "object",
27+
additionalProperties: false,
28+
properties: {
29+
"text": { type: "string" },
30+
"is_last": { type: "boolean" },
31+
"filters": { type: "array", additionalItems: false }
32+
}
33+
}
34+
}
35+
},
36+
data: {
37+
"is_and": false,
38+
"filters": [
39+
{
40+
"is_and": false,
41+
"filters": [
42+
{
43+
"is_and": true,
44+
"filters": [
45+
{
46+
"is_and": true,
47+
"filters": [
48+
{
49+
"is_and": true,
50+
"filters": [
51+
{
52+
"is_and": true,
53+
"filters": [
54+
{
55+
"text": "ABC",
56+
"is_last": true,
57+
"filters": []
58+
}
59+
]
60+
}
61+
]
62+
}
63+
]
64+
}
65+
]
66+
}
67+
]
68+
}
69+
]
70+
},
71+
valid: true
72+
}
73+
]
74+
};

Diff for: test/spec/ZSchemaTestSuiteSpec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ var testSuiteFiles = [
2121
// issues
2222
require("../ZSchemaTestSuite/Issue12.js"),
2323
require("../ZSchemaTestSuite/Issue13.js"),
24-
require("../ZSchemaTestSuite/Issue16.js")
24+
require("../ZSchemaTestSuite/Issue16.js"),
25+
require("../ZSchemaTestSuite/Issue22.js")
2526
];
2627

2728
describe("ZSchemaTestSuite", function () {
@@ -33,8 +34,8 @@ describe("ZSchemaTestSuite", function () {
3334
}
3435
}
3536

36-
it("should contain 16 files", function () {
37-
expect(testSuiteFiles.length).toBe(16);
37+
it("should contain 17 files", function () {
38+
expect(testSuiteFiles.length).toBe(17);
3839
});
3940

4041
testSuiteFiles.forEach(function (testSuite) {

0 commit comments

Comments
 (0)