Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit a4dcfa5

Browse files
committed
fix schema
1 parent f8219ee commit a4dcfa5

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

tests/all.test.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const { createModel, DUMMY_VALUES } = require('./init');
21
const Sequelize = require('sequelize');
2+
const { createModel, DUMMY_VALUES } = require('./init');
3+
34
const sequelize = new Sequelize('sqlite::memory:');
45
const serialize = require('../lib/index');
56

@@ -242,15 +243,15 @@ describe('Serializers', () => {
242243
});
243244

244245
it('anyOf with conflicting subproperties', () => {
245-
class ModelA extends Sequelize.Model {}
246+
class ModelA extends Sequelize.Model { }
246247

247248
ModelA.init(
248249
{
249250
a: Sequelize.DataTypes.JSONB,
250251
},
251252
{ sequelize },
252253
);
253-
254+
254255
const schema = {
255256
type: 'object',
256257
properties: {
@@ -260,43 +261,49 @@ describe('Serializers', () => {
260261
type: 'object',
261262
properties: {
262263
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+
},
269273
},
270274
},
271275
},
272276
{
273277
type: 'object',
274278
properties: {
275279
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+
},
282289
},
283290
},
284291
},
285-
]
292+
],
286293
},
287294
},
288295
};
289296

290297
const instanceA = new ModelA({
291298
a: {
292-
arr: [{foo: true}]
293-
}
299+
arr: [{ foo: true }],
300+
},
294301
});
295302

296303
expect(serialize(instanceA, schema)).toEqual({
297304
a: {
298-
arr: [{foo: true}]
299-
}
305+
arr: [{ foo: true }],
306+
},
300307
});
301-
})
308+
});
302309
});

0 commit comments

Comments
 (0)