From 5c4cafd67fd93f478034404c53d813f2f893045c Mon Sep 17 00:00:00 2001 From: czlonkowski <56956555+czlonkowski@users.noreply.github.com> Date: Mon, 28 Jul 2025 23:52:34 +0200 Subject: [PATCH] fix: handle workflow generation in loadFixtures for templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed loadFixtures to properly generate workflow object from template nodes - Ensured workflow_json is never NULL when saving templates from fixtures - Maintains compatibility with both TemplateWorkflow and TemplateDetail formats This resolves the database constraint error in fixture loading tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/utils/database-utils.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/utils/database-utils.ts b/tests/utils/database-utils.ts index cd2233c..57a0d8a 100644 --- a/tests/utils/database-utils.ts +++ b/tests/utils/database-utils.ts @@ -414,7 +414,17 @@ export async function loadFixtures( description: template.description, views: template.views || template.totalViews || 0, createdAt: template.createdAt, - workflow: template.workflow + workflow: template.workflow || { + nodes: template.nodes?.map((n: any, i: number) => ({ + id: `node_${i}`, + name: n.name, + type: `n8n-nodes-base.${n.name.toLowerCase()}`, + position: [250 + i * 200, 300], + parameters: {} + })) || [], + connections: {}, + settings: {} + } }; await templateRepo.saveTemplate(template, detail); }