feat: Implement import flow API endpoint
This commit is contained in:
35
packages/backend/test/mocks/rest/api/v1/flows/import-flow.js
Normal file
35
packages/backend/test/mocks/rest/api/v1/flows/import-flow.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { expect } from 'vitest';
|
||||
|
||||
const importFlowMock = async (flow, steps = []) => {
|
||||
const data = {
|
||||
name: flow.name,
|
||||
status: flow.active ? 'published' : 'draft',
|
||||
active: flow.active,
|
||||
};
|
||||
|
||||
if (steps.length) {
|
||||
data.steps = steps.map((step) => ({
|
||||
appKey: step.appKey,
|
||||
iconUrl: step.iconUrl,
|
||||
key: step.key,
|
||||
name: step.name,
|
||||
parameters: expect.any(Object),
|
||||
position: step.position,
|
||||
status: 'incomplete',
|
||||
type: step.type,
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: 1,
|
||||
currentPage: null,
|
||||
isArray: false,
|
||||
totalPages: null,
|
||||
type: 'Flow',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default importFlowMock;
|
||||
Reference in New Issue
Block a user