feat: Implement datastore model tests
This commit is contained in:
28
packages/backend/src/models/datastore.test.js
Normal file
28
packages/backend/src/models/datastore.test.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import Datastore from './datastore';
|
||||||
|
|
||||||
|
describe('Datastore model', () => {
|
||||||
|
it('tableName should return correct name', () => {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user