Skip to content

Commit da687ca

Browse files
committed
Enforce a consistent code style for contains tests
1 parent b163efc commit da687ca

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

tests/draft-future/contains.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"description": "contains keyword validation",
44
"schema": {
5-
"contains": {"minimum": 5}
5+
"contains": { "minimum": 5 }
66
},
77
"tests": [
88
{
@@ -62,7 +62,7 @@
6262
},
6363
{
6464
"description": "contains keyword with boolean schema true",
65-
"schema": {"contains": true},
65+
"schema": { "contains": true },
6666
"tests": [
6767
{
6868
"description": "any non-empty array is valid",
@@ -78,7 +78,7 @@
7878
},
7979
{
8080
"description": "contains keyword with boolean schema false",
81-
"schema": {"contains": false},
81+
"schema": { "contains": false },
8282
"tests": [
8383
{
8484
"description": "any non-empty array is invalid",
@@ -106,22 +106,22 @@
106106
"tests": [
107107
{
108108
"description": "matches items, does not match contains",
109-
"data": [ 2, 4, 8 ],
109+
"data": [2, 4, 8],
110110
"valid": false
111111
},
112112
{
113113
"description": "does not match items, matches contains",
114-
"data": [ 3, 6, 9 ],
114+
"data": [3, 6, 9],
115115
"valid": false
116116
},
117117
{
118118
"description": "matches both items and contains",
119-
"data": [ 6, 12 ],
119+
"data": [6, 12],
120120
"valid": true
121121
},
122122
{
123123
"description": "matches neither items nor contains",
124-
"data": [ 1, 5 ],
124+
"data": [1, 5],
125125
"valid": false
126126
}
127127
]

tests/draft-future/maxContains.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,71 +7,71 @@
77
"tests": [
88
{
99
"description": "one item valid against lone maxContains",
10-
"data": [ 1 ],
10+
"data": [1],
1111
"valid": true
1212
},
1313
{
1414
"description": "two items still valid against lone maxContains",
15-
"data": [ 1, 2 ],
15+
"data": [1, 2],
1616
"valid": true
1717
}
1818
]
1919
},
2020
{
2121
"description": "maxContains with contains",
2222
"schema": {
23-
"contains": {"const": 1},
23+
"contains": { "const": 1 },
2424
"maxContains": 1
2525
},
2626
"tests": [
2727
{
2828
"description": "empty data",
29-
"data": [ ],
29+
"data": [],
3030
"valid": false
3131
},
3232
{
3333
"description": "all elements match, valid maxContains",
34-
"data": [ 1 ],
34+
"data": [1],
3535
"valid": true
3636
},
3737
{
3838
"description": "all elements match, invalid maxContains",
39-
"data": [ 1, 1 ],
39+
"data": [1, 1],
4040
"valid": false
4141
},
4242
{
4343
"description": "some elements match, valid maxContains",
44-
"data": [ 1, 2 ],
44+
"data": [1, 2],
4545
"valid": true
4646
},
4747
{
4848
"description": "some elements match, invalid maxContains",
49-
"data": [ 1, 2, 1 ],
49+
"data": [1, 2, 1],
5050
"valid": false
5151
}
5252
]
5353
},
5454
{
5555
"description": "minContains < maxContains",
5656
"schema": {
57-
"contains": {"const": 1},
57+
"contains": { "const": 1 },
5858
"minContains": 1,
5959
"maxContains": 3
6060
},
6161
"tests": [
6262
{
6363
"description": "actual < minContains < maxContains",
64-
"data": [ ],
64+
"data": [],
6565
"valid": false
6666
},
6767
{
6868
"description": "minContains < actual < maxContains",
69-
"data": [ 1, 1 ],
69+
"data": [1, 1],
7070
"valid": true
7171
},
7272
{
7373
"description": "minContains < maxContains < actual",
74-
"data": [ 1, 1, 1, 1 ],
74+
"data": [1, 1, 1, 1],
7575
"valid": false
7676
}
7777
]

tests/draft-future/minContains.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"tests": [
88
{
99
"description": "one item valid against lone minContains",
10-
"data": [ 1 ],
10+
"data": [1],
1111
"valid": true
1212
},
1313
{
@@ -20,151 +20,151 @@
2020
{
2121
"description": "minContains=1 with contains",
2222
"schema": {
23-
"contains": {"const": 1},
23+
"contains": { "const": 1 },
2424
"minContains": 1
2525
},
2626
"tests": [
2727
{
2828
"description": "empty data",
29-
"data": [ ],
29+
"data": [],
3030
"valid": false
3131
},
3232
{
3333
"description": "no elements match",
34-
"data": [ 2 ],
34+
"data": [2],
3535
"valid": false
3636
},
3737
{
3838
"description": "single element matches, valid minContains",
39-
"data": [ 1 ],
39+
"data": [1],
4040
"valid": true
4141
},
4242
{
4343
"description": "some elements match, valid minContains",
44-
"data": [ 1, 2 ],
44+
"data": [1, 2],
4545
"valid": true
4646
},
4747
{
4848
"description": "all elements match, valid minContains",
49-
"data": [ 1, 1 ],
49+
"data": [1, 1],
5050
"valid": true
5151
}
5252
]
5353
},
5454
{
5555
"description": "minContains=2 with contains",
5656
"schema": {
57-
"contains": {"const": 1},
57+
"contains": { "const": 1 },
5858
"minContains": 2
5959
},
6060
"tests": [
6161
{
6262
"description": "empty data",
63-
"data": [ ],
63+
"data": [],
6464
"valid": false
6565
},
6666
{
6767
"description": "all elements match, invalid minContains",
68-
"data": [ 1 ],
68+
"data": [1],
6969
"valid": false
7070
},
7171
{
7272
"description": "some elements match, invalid minContains",
73-
"data": [ 1, 2 ],
73+
"data": [1, 2],
7474
"valid": false
7575
},
7676
{
7777
"description": "all elements match, valid minContains (exactly as needed)",
78-
"data": [ 1, 1 ],
78+
"data": [1, 1],
7979
"valid": true
8080
},
8181
{
8282
"description": "all elements match, valid minContains (more than needed)",
83-
"data": [ 1, 1, 1 ],
83+
"data": [1, 1, 1],
8484
"valid": true
8585
},
8686
{
8787
"description": "some elements match, valid minContains",
88-
"data": [ 1, 2, 1 ],
88+
"data": [1, 2, 1],
8989
"valid": true
9090
}
9191
]
9292
},
9393
{
9494
"description": "maxContains = minContains",
9595
"schema": {
96-
"contains": {"const": 1},
96+
"contains": { "const": 1 },
9797
"maxContains": 2,
9898
"minContains": 2
9999
},
100100
"tests": [
101101
{
102102
"description": "empty data",
103-
"data": [ ],
103+
"data": [],
104104
"valid": false
105105
},
106106
{
107107
"description": "all elements match, invalid minContains",
108-
"data": [ 1 ],
108+
"data": [1],
109109
"valid": false
110110
},
111111
{
112112
"description": "all elements match, invalid maxContains",
113-
"data": [ 1, 1, 1 ],
113+
"data": [1, 1, 1],
114114
"valid": false
115115
},
116116
{
117117
"description": "all elements match, valid maxContains and minContains",
118-
"data": [ 1, 1 ],
118+
"data": [1, 1],
119119
"valid": true
120120
}
121121
]
122122
},
123123
{
124124
"description": "maxContains < minContains",
125125
"schema": {
126-
"contains": {"const": 1},
126+
"contains": { "const": 1 },
127127
"maxContains": 1,
128128
"minContains": 3
129129
},
130130
"tests": [
131131
{
132132
"description": "empty data",
133-
"data": [ ],
133+
"data": [],
134134
"valid": false
135135
},
136136
{
137137
"description": "invalid minContains",
138-
"data": [ 1 ],
138+
"data": [1],
139139
"valid": false
140140
},
141141
{
142142
"description": "invalid maxContains",
143-
"data": [ 1, 1, 1 ],
143+
"data": [1, 1, 1],
144144
"valid": false
145145
},
146146
{
147147
"description": "invalid maxContains and minContains",
148-
"data": [ 1, 1 ],
148+
"data": [1, 1],
149149
"valid": false
150150
}
151151
]
152152
},
153153
{
154154
"description": "minContains = 0",
155155
"schema": {
156-
"contains": {"const": 1},
156+
"contains": { "const": 1 },
157157
"minContains": 0
158158
},
159159
"tests": [
160160
{
161161
"description": "empty data",
162-
"data": [ ],
162+
"data": [],
163163
"valid": true
164164
},
165165
{
166166
"description": "minContains = 0 makes contains always pass",
167-
"data": [ 2 ],
167+
"data": [2],
168168
"valid": true
169169
}
170170
]

0 commit comments

Comments
 (0)