test: Implement tests for user template serializer

This commit is contained in:
Faruk AYDIN
2025-03-06 15:18:33 +01:00
parent 8ba72db463
commit 67dfa822e7

View 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);
});
});