|
79 | 79 | }],
|
80 | 80 | invalid: [{
|
81 | 81 | data: {
|
82 |
| - intKey: 3, |
| 82 | + intKey: 'three', |
83 | 83 | stringKey: false
|
84 | 84 | }
|
85 | 85 | }]
|
|
130 | 130 | data: {
|
131 | 131 | skin: 'thin',
|
132 | 132 | colors: ['yellow'],
|
133 |
| - taste: 0 |
| 133 | + taste: 0, |
| 134 | + worms: 2 |
134 | 135 | }
|
135 | 136 | }, {
|
136 | 137 | data: {
|
137 | 138 | skin: 'thin',
|
138 | 139 | colors: [1, 2, 3],
|
139 |
| - taste: 5 |
| 140 | + taste: 4 |
140 | 141 | }
|
141 | 142 | }, {
|
142 | 143 | data: {
|
143 | 144 | skin: 321,
|
144 |
| - colors: ['yellow'], |
| 145 | + colors: ['yellow', 'yellow'], |
145 | 146 | taste: 5
|
146 | 147 | }
|
147 | 148 | }, { data: {
|
148 | 149 | skin: 'thin',
|
149 | 150 | colors: ['yellow'],
|
150 |
| - taste: 5, |
| 151 | + taste: 4, |
151 | 152 | worms: 3
|
152 | 153 | }
|
153 | 154 | }]
|
|
214 | 215 | }).to.fail('#' + i);
|
215 | 216 | });
|
216 | 217 | });
|
| 218 | + it('should/expect output single negation', function () { |
| 219 | + testCase.invalid.forEach(function (obj, i) { |
| 220 | + expect(function () { |
| 221 | + expect(obj.data).to.be.jsonSchema(testCase.schema, 'expect() #' + i); |
| 222 | + }).to.throw(/(.+?\n){4}/); |
| 223 | + expect(function () { |
| 224 | + obj.data.should.be.jsonSchema(testCase.schema, 'should #' + i); |
| 225 | + }).to.throw(/(.+?\n){4}/); |
| 226 | + }); |
| 227 | + }); |
| 228 | + describe('should/expect output multiple negation', function () { |
| 229 | + before(function () { |
| 230 | + chai.tv4.multiple = true; |
| 231 | + }); |
| 232 | + after(function () { |
| 233 | + chai.tv4.multiple = false; |
| 234 | + }); |
| 235 | + it('should/expect multiple negation', function () { |
| 236 | + testCase.invalid.forEach(function (obj, i) { |
| 237 | + expect(function () { |
| 238 | + expect(obj.data).to.be.jsonSchema(testCase.schema, 'expect() #' + i); |
| 239 | + }).to.throw(/(.+?\n){5,}/); |
| 240 | + expect(function () { |
| 241 | + obj.data.should.be.jsonSchema(testCase.schema, 'should #' + i); |
| 242 | + }).to.throw(/(.+?\n){5,}/); |
| 243 | + }); |
| 244 | + }); |
| 245 | + }); |
217 | 246 | });
|
218 | 247 | });
|
219 | 248 | });
|
|
252 | 281 | }).to.fail('#' + i);
|
253 | 282 | });
|
254 | 283 | });
|
| 284 | + it('should/expect output single negation', function () { |
| 285 | + testCase.invalid.forEach(function (obj, i) { |
| 286 | + expect(function () { |
| 287 | + assert.jsonSchema(obj.data, testCase.schema, '#' + i); |
| 288 | + }).to.throw(/(.+?\n){4}/); |
| 289 | + }); |
| 290 | + }); |
| 291 | + describe('should/expect output multiple negation', function () { |
| 292 | + before(function () { |
| 293 | + chai.tv4.multiple = true; |
| 294 | + }); |
| 295 | + after(function () { |
| 296 | + chai.tv4.multiple = false; |
| 297 | + }); |
| 298 | + it('should/expect multiple negation', function () { |
| 299 | + testCase.invalid.forEach(function (obj, i) { |
| 300 | + expect(function () { |
| 301 | + assert.jsonSchema(obj.data, testCase.schema, '#' + i); |
| 302 | + }).to.throw(/(.+?\n){5,}/); |
| 303 | + }); |
| 304 | + }); |
| 305 | + }); |
255 | 306 | });
|
256 | 307 | });
|
257 | 308 | });
|
|
0 commit comments