Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export class DuplicateWorkflowUseCase {
steps: this.mapStepsToDuplicate(originWorkflow.steps),
preferences: this.mapPreferences(preferences),
isTranslationEnabled: overrides.isTranslationEnabled ?? originWorkflow.isTranslationEnabled,
payloadSchema: originWorkflow.payloadSchema || null,
validatePayload: originWorkflow.validatePayload,
severity: originWorkflow.severity,
};
}

Expand Down
31 changes: 31 additions & 0 deletions apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,37 @@ describe('Workflow Controller E2E API Testing #novu-v2', () => {
expect(res.error!.message).to.contain('Workflow');
expect(res.error!.ctx?.workflowId).to.contain('123');
});

it('should duplicate a workflow with payloadSchema, validatePayload, and severity', async () => {
const payloadSchema = {
type: 'object',
properties: {
name: { type: 'string' },
email: { type: 'string' },
},
required: ['name'],
};
const createWorkflowDto: CreateWorkflowDto = buildWorkflow({
name: 'Test Workflow with Schema',
payloadSchema,
validatePayload: true,
});
const workflowCreated = await createWorkflow(apiClient, createWorkflowDto);

const duplicatedWorkflow = (
await apiClient.workflows.duplicate(
{
name: 'Duplicated Workflow with Schema',
},
workflowCreated.id
)
).result;

expect(duplicatedWorkflow?.id).to.not.equal(workflowCreated.id);
expect(duplicatedWorkflow?.payloadSchema).to.deep.equal(payloadSchema);
expect(duplicatedWorkflow?.validatePayload).to.equal(true);
expect(duplicatedWorkflow?.severity).to.equal(workflowCreated.severity);
});
});

describe('Get step data', () => {
Expand Down
Loading