File tree Expand file tree Collapse file tree 2 files changed +122
-122
lines changed Expand file tree Collapse file tree 2 files changed +122
-122
lines changed Original file line number Diff line number Diff line change 49
49
this . assert ( false , message + ' expected #{this} to fail' ) ;
50
50
} ) ;
51
51
} ) ;
52
- var tests = [ ] ;
53
- tests . push ( {
52
+ var tests = [ {
54
53
name : 'properties' ,
55
54
schema : {
56
- " properties" : {
57
- " intKey" : {
58
- " type" : " integer"
55
+ properties : {
56
+ intKey : {
57
+ type : ' integer'
59
58
} ,
60
- " stringKey" : {
61
- " type" : " string"
59
+ stringKey : {
60
+ type : ' string'
62
61
}
63
62
}
64
63
} ,
65
- valid : [
66
- { data : {
67
- " intKey" : 1 ,
68
- " stringKey" : " one"
69
- } }
70
- ] ,
71
- invalid : [
72
- { data : {
73
- " intKey" : 3 ,
74
- " stringKey" : false
75
- } }
76
- ]
64
+ valid : [ {
65
+ data : {
66
+ intKey : 1 ,
67
+ stringKey : ' one'
68
+ }
69
+ } ] ,
70
+ invalid : [ {
71
+ data : {
72
+ intKey : 3 ,
73
+ stringKey : false
74
+ }
75
+ } ]
77
76
} , {
78
77
name : 'combinations' ,
79
78
schema : {
80
- "id" : " any_v1" ,
81
- " anyOf" : [
82
- { " type" : " integer" } ,
83
- { " type" : " string" }
79
+ id : ' any_v1' ,
80
+ anyOf : [
81
+ { type : ' integer' } ,
82
+ { type : ' string' }
84
83
]
85
84
} ,
86
85
valid : [
87
- { data : 1 } ,
88
- { data : "yo" }
86
+ { data : 1 } ,
87
+ { data : 'yo' }
89
88
] ,
90
89
invalid : [
91
- { data : [ 1 , 2 , 3 ] } ,
92
- { data : { aa : 1 } }
90
+ { data : [ 1 , 2 , 3 ] } ,
91
+ { data : { aa : 1 } }
93
92
]
94
93
} , {
95
94
name : 'fruit' ,
96
95
schema : {
97
- "id" : " fruit_v1" ,
98
- " description" : " fresh fruit schema v1" ,
99
- " type" : " object" ,
100
- " properties" : {
101
- " required" : [ " skin" , " colors" , " taste" ] ,
102
- " colors" : {
103
- " type" : " array" ,
104
- " minItems" : 1 ,
105
- " uniqueItems" : true ,
106
- " items" : {
107
- " type" : " string"
96
+ id : ' fruit_v1' ,
97
+ description : ' fresh fruit schema v1' ,
98
+ type : ' object' ,
99
+ properties : {
100
+ required : [ ' skin' , ' colors' , ' taste' ] ,
101
+ colors : {
102
+ type : ' array' ,
103
+ minItems : 1 ,
104
+ uniqueItems : true ,
105
+ items : {
106
+ type : ' string'
108
107
}
109
108
} ,
110
- " skin" : {
111
- " type" : " string"
109
+ skin : {
110
+ type : ' string'
112
111
} ,
113
- " taste" : {
114
- " type" : " number" ,
115
- " minimum" : 5
112
+ taste : {
113
+ type : ' number' ,
114
+ minimum : 5
116
115
}
117
116
}
118
117
} ,
119
- valid : [
120
- { data : {
121
- skin : " thin" ,
122
- colors : [ " red" , " green" , " yellow" ] ,
118
+ valid : [ {
119
+ data : {
120
+ skin : ' thin' ,
121
+ colors : [ ' red' , ' green' , ' yellow' ] ,
123
122
taste : 10
124
- } }
125
- ] ,
126
- invalid : [
127
- { data : {
128
- colors : [ " brown" ] ,
123
+ }
124
+ } ] ,
125
+ invalid : [ {
126
+ data : {
127
+ colors : [ ' brown' ] ,
129
128
taste : 0 ,
130
129
worms : 2
131
- } }
132
- ]
133
- } ) ;
130
+ }
131
+ } ]
132
+ } ] ;
134
133
135
134
it ( 'has tests' , function ( ) {
136
135
assert . isArray ( tests , 'tests' ) ;
Original file line number Diff line number Diff line change 59
59
} ) ;
60
60
61
61
describe ( 'assertions' , function ( ) {
62
- var tests = [ ] ;
63
- tests . push ( {
62
+ var tests = [ {
64
63
name : 'properties' ,
65
64
schema : {
66
- " properties" : {
67
- " intKey" : {
68
- " type" : " integer"
65
+ properties : {
66
+ intKey : {
67
+ type : ' integer'
69
68
} ,
70
- " stringKey" : {
71
- " type" : " string"
69
+ stringKey : {
70
+ type : ' string'
72
71
}
73
72
}
74
73
} ,
75
- valid : [
76
- { data : {
77
- "intKey" : 1 ,
78
- "stringKey" : "one"
79
- } }
80
- ] ,
81
- invalid : [
82
- { data : {
83
- "intKey" : 3 ,
84
- "stringKey" : false
85
- } }
86
- ]
87
- } ) ;
88
- tests . push ( {
74
+ valid : [ {
75
+ data : {
76
+ intKey : 1 ,
77
+ stringKey : 'one'
78
+ }
79
+ } ] ,
80
+ invalid : [ {
81
+ data : {
82
+ intKey : 3 ,
83
+ stringKey : false
84
+ }
85
+ } ]
86
+ } , {
89
87
name : 'fruit' ,
90
88
schema : {
91
- "id" : " fruit_v1" ,
92
- " description" : " fresh fruit schema v1" ,
93
- " type" : " object" ,
94
- " required" : [ " skin" , " colors" , " taste" ] ,
95
- " properties" : {
96
- " colors" : {
97
- " type" : " array" ,
98
- " minItems" : 1 ,
99
- " uniqueItems" : true ,
100
- " items" : {
101
- " type" : " string"
89
+ id : ' fruit_v1' ,
90
+ description : ' fresh fruit schema v1' ,
91
+ type : ' object' ,
92
+ required : [ ' skin' , ' colors' , ' taste' ] ,
93
+ properties : {
94
+ colors : {
95
+ type : ' array' ,
96
+ minItems : 1 ,
97
+ uniqueItems : true ,
98
+ items : {
99
+ type : ' string'
102
100
}
103
101
} ,
104
- " skin" : {
105
- " type" : " string"
102
+ skin : {
103
+ type : ' string'
106
104
} ,
107
- " taste" : {
108
- " type" : " number" ,
109
- " minimum" : 5
105
+ taste : {
106
+ type : ' number' ,
107
+ minimum : 5
110
108
} ,
111
- " worms" : {
112
- " type" : " number" ,
113
- " maximum" : 1
109
+ worms : {
110
+ type : ' number' ,
111
+ maximum : 1
114
112
}
115
113
}
116
114
} ,
117
- valid : [
118
- { data : {
119
- skin : " thin" ,
120
- colors : [ " red" , " green" , " yellow" ] ,
115
+ valid : [ {
116
+ data : {
117
+ skin : ' thin' ,
118
+ colors : [ ' red' , ' green' , ' yellow' ] ,
121
119
taste : 10
122
- } } ,
123
- { data : {
124
- skin : "thin" ,
125
- colors : [ "yellow" ] ,
120
+ }
121
+ } , {
122
+ data : {
123
+ skin : 'thin' ,
124
+ colors : [ 'yellow' ] ,
126
125
taste : 5 ,
127
126
worms : 1
128
- } }
129
- ] ,
130
- invalid : [
131
- { data : {
132
- skin : " thin" ,
133
- colors : [ " yellow" ] ,
127
+ }
128
+ } ] ,
129
+ invalid : [ {
130
+ data : {
131
+ skin : ' thin' ,
132
+ colors : [ ' yellow' ] ,
134
133
taste : 0
135
- } } ,
136
- { data : {
137
- skin : "thin" ,
134
+ }
135
+ } , {
136
+ data : {
137
+ skin : 'thin' ,
138
138
colors : [ 1 , 2 , 3 ] ,
139
139
taste : 5
140
- } } ,
141
- { data : {
140
+ }
141
+ } , {
142
+ data : {
142
143
skin : 321 ,
143
- colors : [ " yellow" ] ,
144
+ colors : [ ' yellow' ] ,
144
145
taste : 5
145
- } } ,
146
- { data : {
147
- skin : " thin" ,
148
- colors : [ " yellow" ] ,
146
+ }
147
+ } , { data : {
148
+ skin : ' thin' ,
149
+ colors : [ ' yellow' ] ,
149
150
taste : 5 ,
150
151
worms : 3
151
- } }
152
- ]
153
- } ) ;
152
+ }
153
+ } ]
154
+ } ] ;
154
155
describe ( 'check test data' , function ( ) {
155
156
it ( 'has tests' , function ( ) {
156
157
assert . isArray ( tests , 'tests' ) ;
You can’t perform that action at this time.
0 commit comments