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