refactor: Use internal namespace for the existing API
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
const createDynamicFieldsMock = async () => {
|
||||
const data = [
|
||||
{
|
||||
label: 'Bot name',
|
||||
key: 'botName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
value: 'Automatisch',
|
||||
description:
|
||||
'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Bot icon',
|
||||
key: 'botIcon',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:',
|
||||
variables: true,
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: data.length,
|
||||
currentPage: null,
|
||||
isArray: true,
|
||||
totalPages: null,
|
||||
type: 'Object',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default createDynamicFieldsMock;
|
||||
@@ -0,0 +1,26 @@
|
||||
const getConnectionMock = async (connection) => {
|
||||
const data = {
|
||||
id: connection.id,
|
||||
key: connection.key,
|
||||
verified: connection.verified,
|
||||
oauthClientId: connection.oauthClientId,
|
||||
formattedData: {
|
||||
screenName: connection.formattedData.screenName,
|
||||
},
|
||||
createdAt: connection.createdAt.getTime(),
|
||||
updatedAt: connection.updatedAt.getTime(),
|
||||
};
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: 1,
|
||||
currentPage: null,
|
||||
isArray: false,
|
||||
totalPages: null,
|
||||
type: 'Connection',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default getConnectionMock;
|
||||
@@ -0,0 +1,42 @@
|
||||
const getPreviousStepsMock = async (steps, executionSteps) => {
|
||||
const data = steps.map((step) => {
|
||||
const filteredExecutionSteps = executionSteps.filter(
|
||||
(executionStep) => executionStep.stepId === step.id
|
||||
);
|
||||
|
||||
return {
|
||||
id: step.id,
|
||||
type: step.type,
|
||||
key: step.key,
|
||||
name: step.name,
|
||||
appKey: step.appKey,
|
||||
iconUrl: step.iconUrl,
|
||||
webhookUrl: step.webhookUrl,
|
||||
status: step.status,
|
||||
position: step.position,
|
||||
parameters: step.parameters,
|
||||
executionSteps: filteredExecutionSteps.map((executionStep) => ({
|
||||
id: executionStep.id,
|
||||
dataIn: executionStep.dataIn,
|
||||
dataOut: executionStep.dataOut,
|
||||
errorDetails: executionStep.errorDetails,
|
||||
status: executionStep.status,
|
||||
createdAt: executionStep.createdAt.getTime(),
|
||||
updatedAt: executionStep.updatedAt.getTime(),
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: data.length,
|
||||
currentPage: null,
|
||||
isArray: true,
|
||||
totalPages: null,
|
||||
type: 'Step',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default getPreviousStepsMock;
|
||||
@@ -0,0 +1,34 @@
|
||||
const testStepMock = async (step, lastExecutionStep) => {
|
||||
const data = {
|
||||
id: step.id,
|
||||
appKey: step.appKey,
|
||||
key: step.key,
|
||||
iconUrl: step.iconUrl,
|
||||
lastExecutionStep: {
|
||||
id: lastExecutionStep.id,
|
||||
status: lastExecutionStep.status,
|
||||
dataIn: lastExecutionStep.dataIn,
|
||||
dataOut: lastExecutionStep.dataOut,
|
||||
errorDetails: lastExecutionStep.errorDetails,
|
||||
createdAt: lastExecutionStep.createdAt.getTime(),
|
||||
updatedAt: lastExecutionStep.updatedAt.getTime(),
|
||||
},
|
||||
parameters: step.parameters,
|
||||
position: step.position,
|
||||
status: step.status,
|
||||
type: step.type,
|
||||
};
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: 1,
|
||||
currentPage: null,
|
||||
isArray: false,
|
||||
totalPages: null,
|
||||
type: 'Step',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default testStepMock;
|
||||
@@ -0,0 +1,27 @@
|
||||
const updateStepMock = (step) => {
|
||||
const data = {
|
||||
id: step.id,
|
||||
type: step.type || 'action',
|
||||
key: step.key || null,
|
||||
name: step.name || null,
|
||||
appKey: step.appKey || null,
|
||||
iconUrl: step.iconUrl || null,
|
||||
webhookUrl: step.webhookUrl || null,
|
||||
status: step.status || 'incomplete',
|
||||
position: step.position,
|
||||
parameters: step.parameters || {},
|
||||
};
|
||||
|
||||
return {
|
||||
data,
|
||||
meta: {
|
||||
type: 'Step',
|
||||
count: 1,
|
||||
isArray: false,
|
||||
currentPage: null,
|
||||
totalPages: null,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default updateStepMock;
|
||||
Reference in New Issue
Block a user