Merge pull request #2095 from automatisch/datastore-tests
feat: Implement datastore model tests
This commit is contained in:
@@ -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",
|
||||
}
|
||||
`;
|
@@ -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' },
|
||||
|
12
packages/backend/src/models/datastore.test.js
Normal file
12
packages/backend/src/models/datastore.test.js
Normal 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();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user