|
|
|
@ -113,13 +113,13 @@ describe(WorkflowService.name, () => {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [
|
|
|
|
filters: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
filterId: testFilterId,
|
|
|
|
pluginFilterId: testFilterId,
|
|
|
|
filterConfig: { key: 'value' },
|
|
|
|
filterConfig: { key: 'value' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
actionId: testActionId,
|
|
|
|
pluginActionId: testActionId,
|
|
|
|
actionConfig: { action: 'test' },
|
|
|
|
actionConfig: { action: 'test' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -137,7 +137,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
expect(workflow.filters[0]).toMatchObject({
|
|
|
|
expect(workflow.filters[0]).toMatchObject({
|
|
|
|
id: expect.any(String),
|
|
|
|
id: expect.any(String),
|
|
|
|
workflowId: workflow.id,
|
|
|
|
workflowId: workflow.id,
|
|
|
|
filterId: testFilterId,
|
|
|
|
pluginFilterId: testFilterId,
|
|
|
|
filterConfig: { key: 'value' },
|
|
|
|
filterConfig: { key: 'value' },
|
|
|
|
order: 0,
|
|
|
|
order: 0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -146,7 +146,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
expect(workflow.actions[0]).toMatchObject({
|
|
|
|
expect(workflow.actions[0]).toMatchObject({
|
|
|
|
id: expect.any(String),
|
|
|
|
id: expect.any(String),
|
|
|
|
workflowId: workflow.id,
|
|
|
|
workflowId: workflow.id,
|
|
|
|
actionId: testActionId,
|
|
|
|
pluginActionId: testActionId,
|
|
|
|
actionConfig: { action: 'test' },
|
|
|
|
actionConfig: { action: 'test' },
|
|
|
|
order: 0,
|
|
|
|
order: 0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -163,7 +163,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'invalid-workflow',
|
|
|
|
name: 'invalid-workflow',
|
|
|
|
description: 'A workflow with invalid filter',
|
|
|
|
description: 'A workflow with invalid filter',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: factory.uuid(), filterConfig: { key: 'value' } }],
|
|
|
|
filters: [{ pluginFilterId: factory.uuid(), filterConfig: { key: 'value' } }],
|
|
|
|
actions: [],
|
|
|
|
actions: [],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
).rejects.toThrow('Invalid filter ID');
|
|
|
|
).rejects.toThrow('Invalid filter ID');
|
|
|
|
@ -181,7 +181,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
description: 'A workflow with invalid action',
|
|
|
|
description: 'A workflow with invalid action',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [],
|
|
|
|
filters: [],
|
|
|
|
actions: [{ actionId: factory.uuid(), actionConfig: { action: 'test' } }],
|
|
|
|
actions: [{ pluginActionId: factory.uuid(), actionConfig: { action: 'test' } }],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
).rejects.toThrow('Invalid action ID');
|
|
|
|
).rejects.toThrow('Invalid action ID');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -220,7 +220,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'invalid-context-workflow',
|
|
|
|
name: 'invalid-context-workflow',
|
|
|
|
description: 'A workflow with context mismatch',
|
|
|
|
description: 'A workflow with context mismatch',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: result.filters[0].id }],
|
|
|
|
filters: [{ pluginFilterId: result.filters[0].id }],
|
|
|
|
actions: [],
|
|
|
|
actions: [],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
).rejects.toThrow('does not support asset context');
|
|
|
|
).rejects.toThrow('does not support asset context');
|
|
|
|
@ -261,7 +261,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
description: 'A workflow with context mismatch',
|
|
|
|
description: 'A workflow with context mismatch',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [],
|
|
|
|
filters: [],
|
|
|
|
actions: [{ actionId: result.actions[0].id }],
|
|
|
|
actions: [{ pluginActionId: result.actions[0].id }],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
).rejects.toThrow('does not support asset context');
|
|
|
|
).rejects.toThrow('does not support asset context');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -277,13 +277,13 @@ describe(WorkflowService.name, () => {
|
|
|
|
description: 'A workflow with multiple filters and actions',
|
|
|
|
description: 'A workflow with multiple filters and actions',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [
|
|
|
|
filters: [
|
|
|
|
{ filterId: testFilterId, filterConfig: { step: 1 } },
|
|
|
|
{ pluginFilterId: testFilterId, filterConfig: { step: 1 } },
|
|
|
|
{ filterId: testFilterId, filterConfig: { step: 2 } },
|
|
|
|
{ pluginFilterId: testFilterId, filterConfig: { step: 2 } },
|
|
|
|
],
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
actions: [
|
|
|
|
{ actionId: testActionId, actionConfig: { step: 1 } },
|
|
|
|
{ pluginActionId: testActionId, actionConfig: { step: 1 } },
|
|
|
|
{ actionId: testActionId, actionConfig: { step: 2 } },
|
|
|
|
{ pluginActionId: testActionId, actionConfig: { step: 2 } },
|
|
|
|
{ actionId: testActionId, actionConfig: { step: 3 } },
|
|
|
|
{ pluginActionId: testActionId, actionConfig: { step: 3 } },
|
|
|
|
],
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -378,8 +378,8 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'test-workflow',
|
|
|
|
name: 'test-workflow',
|
|
|
|
description: 'A test workflow',
|
|
|
|
description: 'A test workflow',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: testFilterId, filterConfig: { key: 'value' } }],
|
|
|
|
filters: [{ pluginFilterId: testFilterId, filterConfig: { key: 'value' } }],
|
|
|
|
actions: [{ actionId: testActionId, actionConfig: { action: 'test' } }],
|
|
|
|
actions: [{ pluginActionId: testActionId, actionConfig: { action: 'test' } }],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const workflow = await sut.get(auth, created.id);
|
|
|
|
const workflow = await sut.get(auth, created.id);
|
|
|
|
@ -461,14 +461,14 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'test-workflow',
|
|
|
|
name: 'test-workflow',
|
|
|
|
description: 'Test',
|
|
|
|
description: 'Test',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: testFilterId, filterConfig: { old: 'config' } }],
|
|
|
|
filters: [{ pluginFilterId: testFilterId, filterConfig: { old: 'config' } }],
|
|
|
|
actions: [],
|
|
|
|
actions: [],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const updated = await sut.update(auth, created.id, {
|
|
|
|
const updated = await sut.update(auth, created.id, {
|
|
|
|
filters: [
|
|
|
|
filters: [
|
|
|
|
{ filterId: testFilterId, filterConfig: { new: 'config' } },
|
|
|
|
{ pluginFilterId: testFilterId, filterConfig: { new: 'config' } },
|
|
|
|
{ filterId: testFilterId, filterConfig: { second: 'filter' } },
|
|
|
|
{ pluginFilterId: testFilterId, filterConfig: { second: 'filter' } },
|
|
|
|
],
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -488,13 +488,13 @@ describe(WorkflowService.name, () => {
|
|
|
|
description: 'Test',
|
|
|
|
description: 'Test',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [],
|
|
|
|
filters: [],
|
|
|
|
actions: [{ actionId: testActionId, actionConfig: { old: 'config' } }],
|
|
|
|
actions: [{ pluginActionId: testActionId, actionConfig: { old: 'config' } }],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const updated = await sut.update(auth, created.id, {
|
|
|
|
const updated = await sut.update(auth, created.id, {
|
|
|
|
actions: [
|
|
|
|
actions: [
|
|
|
|
{ actionId: testActionId, actionConfig: { new: 'config' } },
|
|
|
|
{ pluginActionId: testActionId, actionConfig: { new: 'config' } },
|
|
|
|
{ actionId: testActionId, actionConfig: { second: 'action' } },
|
|
|
|
{ pluginActionId: testActionId, actionConfig: { second: 'action' } },
|
|
|
|
],
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -513,7 +513,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'test-workflow',
|
|
|
|
name: 'test-workflow',
|
|
|
|
description: 'Test',
|
|
|
|
description: 'Test',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: testFilterId, filterConfig: { key: 'value' } }],
|
|
|
|
filters: [{ pluginFilterId: testFilterId, filterConfig: { key: 'value' } }],
|
|
|
|
actions: [],
|
|
|
|
actions: [],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -588,7 +588,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
await expect(
|
|
|
|
sut.update(auth, created.id, {
|
|
|
|
sut.update(auth, created.id, {
|
|
|
|
filters: [{ filterId: factory.uuid(), filterConfig: {} }],
|
|
|
|
filters: [{ pluginFilterId: factory.uuid(), filterConfig: {} }],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
).rejects.toThrow();
|
|
|
|
).rejects.toThrow();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -608,7 +608,7 @@ describe(WorkflowService.name, () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
await expect(
|
|
|
|
sut.update(auth, created.id, { actions: [{ actionId: factory.uuid(), actionConfig: {} }] }),
|
|
|
|
sut.update(auth, created.id, { actions: [{ pluginActionId: factory.uuid(), actionConfig: {} }] }),
|
|
|
|
).rejects.toThrow();
|
|
|
|
).rejects.toThrow();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -643,8 +643,8 @@ describe(WorkflowService.name, () => {
|
|
|
|
name: 'test-workflow',
|
|
|
|
name: 'test-workflow',
|
|
|
|
description: 'Test',
|
|
|
|
description: 'Test',
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
filters: [{ filterId: testFilterId, filterConfig: {} }],
|
|
|
|
filters: [{ pluginFilterId: testFilterId, filterConfig: {} }],
|
|
|
|
actions: [{ actionId: testActionId, actionConfig: {} }],
|
|
|
|
actions: [{ pluginActionId: testActionId, actionConfig: {} }],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
await sut.delete(auth, workflow.id);
|
|
|
|
await sut.delete(auth, workflow.id);
|
|
|
|
|