Skip to content

Commit 9e24adb

Browse files
committed
Merge pull request #1 from gazpachoking/clean
Add some more tests
2 parents 3649b58 + 3498f34 commit 9e24adb

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

tests/draft3/additionalItems.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[
2+
{
3+
"description": "additionalItems as schema",
4+
"schema": {
5+
"additionalItems": {"type": "integer"}
6+
},
7+
"tests": [
8+
{
9+
"description": "all items match schema",
10+
"data": [ 1, 2, 3, 4.5, 5 ],
11+
"valid": true
12+
}
13+
]
14+
},
15+
{
16+
"description": "items is schema, no additionalItems",
17+
"schema": {
18+
"items": {},
19+
"additionalItems": false
20+
},
21+
"tests": [
22+
{
23+
"description": "all items match schema",
24+
"data": [ 1, 2, 3, 4, 5 ],
25+
"valid": true
26+
}
27+
]
28+
},
29+
{
30+
"description": "array of items with no additionalItems",
31+
"schema": {
32+
"items": [{}, {}, {}],
33+
"additionalItems": false
34+
},
35+
"tests": [
36+
{
37+
"description": "no additional items present",
38+
"data": [ 1, 2, 3 ],
39+
"valid": true
40+
},
41+
{
42+
"description": "additional items are not permitted",
43+
"data": [ 1, 2, 3, 4 ],
44+
"valid": false
45+
}
46+
]
47+
},
48+
{
49+
"description": "additionalItems as false without items",
50+
"schema": {
51+
"additionalItems": false
52+
},
53+
"tests": [
54+
{
55+
"description": "items should allow anything",
56+
"data": [ 1, 2, 3, 4, 5 ],
57+
"valid": true
58+
}
59+
]
60+
}
61+
]

tests/draft3/items.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[
2+
{
3+
"description": "a schema given for items",
4+
"schema": {
5+
"items": {"type": "integer"}
6+
},
7+
"tests": [
8+
{
9+
"description": "valid items",
10+
"data": [ 1, 2, 3 ],
11+
"valid": true
12+
},
13+
{
14+
"description": "wrong type of items",
15+
"data": [1, "x"],
16+
"valid": false
17+
}
18+
]
19+
},
20+
{
21+
"description": "an array of schemas for items",
22+
"schema": {
23+
"items": [
24+
{"type": "integer"},
25+
{"type": "string"}
26+
]
27+
},
28+
"tests": [
29+
{
30+
"description": "correct types",
31+
"data": [ 1, "foo" ],
32+
"valid": true
33+
},
34+
{
35+
"description": "wrong types",
36+
"data": [ "foo", 1 ],
37+
"valid": false
38+
}
39+
]
40+
}
41+
]

0 commit comments

Comments
 (0)