feat: Implement action serializer
This commit is contained in:
21
packages/backend/src/serializers/action.test.js
Normal file
21
packages/backend/src/serializers/action.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import App from '../models/app';
|
||||
import actionSerializer from './action';
|
||||
|
||||
describe('actionSerializer', () => {
|
||||
it('should return the action data', async () => {
|
||||
const actions = await App.findActionsByKey('github');
|
||||
const action = actions[0];
|
||||
|
||||
const expectedPayload = {
|
||||
description: action.description,
|
||||
key: action.key,
|
||||
name: action.name,
|
||||
pollInterval: action.pollInterval,
|
||||
showWebhookUrl: action.showWebhookUrl,
|
||||
type: action.type,
|
||||
};
|
||||
|
||||
expect(actionSerializer(action)).toEqual(expectedPayload);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user