File tree Expand file tree Collapse file tree 2 files changed +122
-125
lines changed Expand file tree Collapse file tree 2 files changed +122
-125
lines changed Original file line number Diff line number Diff line change 40
40
this . assert (
41
41
err instanceof chai . AssertionError
42
42
, message + ' expected #{this} to fail, but it threw ' + inspect ( err ) ) ;
43
- /*this.assert(
44
- err.message === message
45
- , 'expected #{this} to fail with ' + inspect(message) + ', but got ' + inspect(err.message));*/
46
43
return ;
47
44
}
48
45
49
46
this . assert ( false , message + ' expected #{this} to fail' ) ;
50
47
} ) ;
51
48
} ) ;
52
- var tests = [ ] ;
53
- tests . push ( {
49
+ var tests = [ {
54
50
name : 'properties' ,
55
51
schema : {
56
- " properties" : {
57
- " intKey" : {
58
- " type" : " integer"
52
+ properties : {
53
+ intKey : {
54
+ type : ' integer'
59
55
} ,
60
- " stringKey" : {
61
- " type" : " string"
56
+ stringKey : {
57
+ type : ' string'
62
58
}
63
59
}
64
60
} ,
65
- valid : [
66
- { data : {
67
- " intKey" : 1 ,
68
- " stringKey" : " one"
69
- } }
70
- ] ,
71
- invalid : [
72
- { data : {
73
- " intKey" : 3 ,
74
- " stringKey" : false
75
- } }
76
- ]
61
+ valid : [ {
62
+ data : {
63
+ intKey : 1 ,
64
+ stringKey : ' one'
65
+ }
66
+ } ] ,
67
+ invalid : [ {
68
+ data : {
69
+ intKey : 3 ,
70
+ stringKey : false
71
+ }
72
+ } ]
77
73
} , {
78
74
name : 'combinations' ,
79
75
schema : {
80
- "id" : " any_v1" ,
81
- " anyOf" : [
82
- { " type" : " integer" } ,
83
- { " type" : " string" }
76
+ id : ' any_v1' ,
77
+ anyOf : [
78
+ { type : ' integer' } ,
79
+ { type : ' string' }
84
80
]
85
81
} ,
86
82
valid : [
87
- { data : 1 } ,
88
- { data : "yo" }
83
+ { data : 1 } ,
84
+ { data : 'yo' }
89
85
] ,
90
86
invalid : [
91
- { data : [ 1 , 2 , 3 ] } ,
92
- { data : { aa : 1 } }
87
+ { data : [ 1 , 2 , 3 ] } ,
88
+ { data : { aa : 1 } }
93
89
]
94
90
} , {
95
91
name : 'fruit' ,
96
92
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"
93
+ id : ' fruit_v1' ,
94
+ description : ' fresh fruit schema v1' ,
95
+ type : ' object' ,
96
+ properties : {
97
+ required : [ ' skin' , ' colors' , ' taste' ] ,
98
+ colors : {
99
+ type : ' array' ,
100
+ minItems : 1 ,
101
+ uniqueItems : true ,
102
+ items : {
103
+ type : ' string'
108
104
}
109
105
} ,
110
- " skin" : {
111
- " type" : " string"
106
+ skin : {
107
+ type : ' string'
112
108
} ,
113
- " taste" : {
114
- " type" : " number" ,
115
- " minimum" : 5
109
+ taste : {
110
+ type : ' number' ,
111
+ minimum : 5
116
112
}
117
113
}
118
114
} ,
119
- valid : [
120
- { data : {
121
- skin : " thin" ,
122
- colors : [ " red" , " green" , " yellow" ] ,
115
+ valid : [ {
116
+ data : {
117
+ skin : ' thin' ,
118
+ colors : [ ' red' , ' green' , ' yellow' ] ,
123
119
taste : 10
124
- } }
125
- ] ,
126
- invalid : [
127
- { data : {
128
- colors : [ " brown" ] ,
120
+ }
121
+ } ] ,
122
+ invalid : [ {
123
+ data : {
124
+ colors : [ ' brown' ] ,
129
125
taste : 0 ,
130
126
worms : 2
131
- } }
132
- ]
133
- } ) ;
127
+ }
128
+ } ]
129
+ } ] ;
134
130
135
131
it ( 'has tests' , function ( ) {
136
132
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