refactor: Update required validations with custom assertion
This commit is contained in:
@@ -5,7 +5,7 @@ class Datastore extends Base {
|
|||||||
|
|
||||||
static jsonSchema = {
|
static jsonSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
required: ['key', 'value', 'scope', 'scopeId'],
|
required: ['key', 'value', 'scopeId'],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
id: { type: 'string', format: 'uuid' },
|
id: { type: 'string', format: 'uuid' },
|
||||||
|
@@ -6,23 +6,9 @@ describe('Datastore model', () => {
|
|||||||
expect(Datastore.tableName).toBe('datastore');
|
expect(Datastore.tableName).toBe('datastore');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('jsonSchema should have the correct schema', () => {
|
it('jsonSchema should have correct validations', () => {
|
||||||
const expectedSchema = {
|
expect(Datastore).toRequireProperty('key');
|
||||||
type: 'object',
|
expect(Datastore).toRequireProperty('value');
|
||||||
required: ['key', 'value', 'scope', 'scopeId'],
|
expect(Datastore).toRequireProperty('scopeId');
|
||||||
properties: {
|
|
||||||
id: { type: 'string', format: 'uuid' },
|
|
||||||
key: { type: 'string', minLength: 1 },
|
|
||||||
value: { type: 'string' },
|
|
||||||
scope: {
|
|
||||||
type: 'string',
|
|
||||||
enum: ['flow'],
|
|
||||||
default: 'flow',
|
|
||||||
},
|
|
||||||
scopeId: { type: 'string', format: 'uuid' },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(Datastore.jsonSchema).toStrictEqual(expectedSchema);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user