diff --git a/packages/backend/src/models/datastore.test.js b/packages/backend/src/models/datastore.test.js new file mode 100644 index 00000000..cc5eda18 --- /dev/null +++ b/packages/backend/src/models/datastore.test.js @@ -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); + }); +});