Merge pull request #2095 from automatisch/datastore-tests

feat: Implement datastore model tests
This commit is contained in:
Ömer Faruk Aydın
2024-09-30 17:12:11 +03:00
committed by GitHub
3 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Datastore model > jsonSchema should have correct validations 1`] = `
{
"properties": {
"id": {
"format": "uuid",
"type": "string",
},
"key": {
"minLength": 1,
"type": "string",
},
"scope": {
"default": "flow",
"enum": [
"flow",
],
"type": "string",
},
"scopeId": {
"format": "uuid",
"type": "string",
},
"value": {
"type": "string",
},
},
"required": [
"key",
"value",
"scopeId",
],
"type": "object",
}
`;

View File

@@ -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' },

View File

@@ -0,0 +1,12 @@
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 correct validations', () => {
expect(Datastore.jsonSchema).toMatchSnapshot();
});
});