feat(api): get templates endpoint

This commit is contained in:
Ali BARIN
2025-04-25 09:36:14 +00:00
parent b5ca2af0c9
commit fcb160e61a
8 changed files with 110 additions and 23 deletions

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('publicTemplateSerializer', () => {
let template;
beforeEach(async () => {
template = await createTemplate();
});
it('should return template data', async () => {
const expectedPayload = {
id: template.id,
name: template.name,
flowData: template.getFlowDataWithIconUrls(),
createdAt: template.createdAt.getTime(),
updatedAt: template.updatedAt.getTime(),
};
expect(templateSerializer(template)).toStrictEqual(expectedPayload);
});
});