This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree 1 file changed +28
-21
lines changed
1 file changed +28
-21
lines changed Original file line number Diff line number Diff line change 1
- const { createModel, DUMMY_VALUES } = require ( './init' ) ;
2
1
const Sequelize = require ( 'sequelize' ) ;
2
+ const { createModel, DUMMY_VALUES } = require ( './init' ) ;
3
+
3
4
const sequelize = new Sequelize ( 'sqlite::memory:' ) ;
4
5
const serialize = require ( '../lib/index' ) ;
5
6
@@ -242,15 +243,15 @@ describe('Serializers', () => {
242
243
} ) ;
243
244
244
245
it ( 'anyOf with conflicting subproperties' , ( ) => {
245
- class ModelA extends Sequelize . Model { }
246
+ class ModelA extends Sequelize . Model { }
246
247
247
248
ModelA . init (
248
249
{
249
250
a : Sequelize . DataTypes . JSONB ,
250
251
} ,
251
252
{ sequelize } ,
252
253
) ;
253
-
254
+
254
255
const schema = {
255
256
type : 'object' ,
256
257
properties : {
@@ -260,43 +261,49 @@ describe('Serializers', () => {
260
261
type : 'object' ,
261
262
properties : {
262
263
arr : {
263
- type : 'object' ,
264
- properties : {
265
- foo : {
266
- type : 'boolean'
267
- }
268
- }
264
+ type : 'array' ,
265
+ items : {
266
+ type : 'object' ,
267
+ properties : {
268
+ foo : {
269
+ type : 'boolean' ,
270
+ } ,
271
+ } ,
272
+ } ,
269
273
} ,
270
274
} ,
271
275
} ,
272
276
{
273
277
type : 'object' ,
274
278
properties : {
275
279
arr : {
276
- type : 'object' ,
277
- properties : {
278
- bar : {
279
- type : 'boolean'
280
- }
281
- }
280
+ type : 'array' ,
281
+ items : {
282
+ type : 'object' ,
283
+ properties : {
284
+ bar : {
285
+ type : 'boolean' ,
286
+ } ,
287
+ } ,
288
+ } ,
282
289
} ,
283
290
} ,
284
291
} ,
285
- ]
292
+ ] ,
286
293
} ,
287
294
} ,
288
295
} ;
289
296
290
297
const instanceA = new ModelA ( {
291
298
a : {
292
- arr : [ { foo : true } ]
293
- }
299
+ arr : [ { foo : true } ] ,
300
+ } ,
294
301
} ) ;
295
302
296
303
expect ( serialize ( instanceA , schema ) ) . toEqual ( {
297
304
a : {
298
- arr : [ { foo : true } ]
299
- }
305
+ arr : [ { foo : true } ] ,
306
+ } ,
300
307
} ) ;
301
- } )
308
+ } ) ;
302
309
} ) ;
You can’t perform that action at this time.
0 commit comments