test: Implement tests for user template serializer
This commit is contained in:
23
packages/backend/src/serializers/template.ee.test.js
Normal file
23
packages/backend/src/serializers/template.ee.test.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import templateSerializer from './template.ee.js';
|
||||||
|
import { createTemplate } from '../../test/factories/template.js';
|
||||||
|
|
||||||
|
describe('templateSerializer', () => {
|
||||||
|
let template;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
template = await createTemplate();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return flow data', async () => {
|
||||||
|
const expectedPayload = {
|
||||||
|
id: template.id,
|
||||||
|
name: template.name,
|
||||||
|
flowData: template.flowData,
|
||||||
|
createdAt: template.createdAt.getTime(),
|
||||||
|
updatedAt: template.updatedAt.getTime(),
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(templateSerializer(template)).toStrictEqual(expectedPayload);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user