Skip to content

Commit 44b99ed

Browse files
Merge pull request #373 from karenetheridge/ether/items-and-contains
a few more "contains" tests
2 parents a3f9e2e + 4a2b52f commit 44b99ed

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

tests/draft2019-09/contains.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,40 @@
8989
"description": "empty array is invalid",
9090
"data": [],
9191
"valid": false
92+
},
93+
{
94+
"description": "non-arrays are valid",
95+
"data": "contains does not apply to strings",
96+
"valid": true
97+
}
98+
]
99+
},
100+
{
101+
"description": "items + contains",
102+
"schema": {
103+
"items": { "multipleOf": 2 },
104+
"contains": { "multipleOf": 3 }
105+
},
106+
"tests": [
107+
{
108+
"description": "matches items, does not match contains",
109+
"data": [ 2, 4, 8 ],
110+
"valid": false
111+
},
112+
{
113+
"description": "does not match items, matches contains",
114+
"data": [ 3, 6, 9 ],
115+
"valid": false
116+
},
117+
{
118+
"description": "matches both items and contains",
119+
"data": [ 6, 12 ],
120+
"valid": true
121+
},
122+
{
123+
"description": "matches neither items nor contains",
124+
"data": [ 1, 5 ],
125+
"valid": false
92126
}
93127
]
94128
}

tests/draft6/contains.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,34 @@
9696
"valid": true
9797
}
9898
]
99+
},
100+
{
101+
"description": "items + contains",
102+
"schema": {
103+
"items": { "multipleOf": 2 },
104+
"contains": { "multipleOf": 3 }
105+
},
106+
"tests": [
107+
{
108+
"description": "matches items, does not match contains",
109+
"data": [ 2, 4, 8 ],
110+
"valid": false
111+
},
112+
{
113+
"description": "does not match items, matches contains",
114+
"data": [ 3, 6, 9 ],
115+
"valid": false
116+
},
117+
{
118+
"description": "matches both items and contains",
119+
"data": [ 6, 12 ],
120+
"valid": true
121+
},
122+
{
123+
"description": "matches neither items nor contains",
124+
"data": [ 1, 5 ],
125+
"valid": false
126+
}
127+
]
99128
}
100129
]

tests/draft7/contains.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,34 @@
9696
"valid": true
9797
}
9898
]
99+
},
100+
{
101+
"description": "items + contains",
102+
"schema": {
103+
"items": { "multipleOf": 2 },
104+
"contains": { "multipleOf": 3 }
105+
},
106+
"tests": [
107+
{
108+
"description": "matches items, does not match contains",
109+
"data": [ 2, 4, 8 ],
110+
"valid": false
111+
},
112+
{
113+
"description": "does not match items, matches contains",
114+
"data": [ 3, 6, 9 ],
115+
"valid": false
116+
},
117+
{
118+
"description": "matches both items and contains",
119+
"data": [ 6, 12 ],
120+
"valid": true
121+
},
122+
{
123+
"description": "matches neither items nor contains",
124+
"data": [ 1, 5 ],
125+
"valid": false
126+
}
127+
]
99128
}
100129
]

0 commit comments

Comments
 (0)