From 6e2442bc7a2e5995d264841d73b4869a61a47e9c Mon Sep 17 00:00:00 2001 From: Felix Ng Date: Fri, 3 Apr 2026 15:19:42 -0700 Subject: [PATCH] fix: align mock mode outputs with actual node output schemas Update all hardcoded mock outputs in mock-generator.ts to match the real Zod output schemas defined in each node. Fixes mismatches for: end, delay, map, filter, http_request, reddit_monitor, twitter_monitor, social_keyword_generator, and draft_emails. Closes #62 --- .../playground/src/utils/mock-generator.ts | 75 ++++++++++++++----- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/packages/playground/src/utils/mock-generator.ts b/packages/playground/src/utils/mock-generator.ts index af15200..7976369 100644 --- a/packages/playground/src/utils/mock-generator.ts +++ b/packages/playground/src/utils/mock-generator.ts @@ -128,28 +128,33 @@ export function generateMockOutput( selectedBranch: 'true', }, end: { - terminated: true, - reason: 'Workflow completed successfully', + completed: true, + message: 'Workflow completed successfully', }, delay: { - delayed: true, - delayMs: 1000, + waited: true, + actualDurationMs: 1000, + message: 'Waited for 1000ms', }, map: { - result: [ + results: [ { transformed: 'item1' }, { transformed: 'item2' }, ], + count: 2, }, filter: { - result: [{ passes: true }], + results: [{ passes: true }], + count: 1, originalCount: 3, - filteredCount: 1, }, http_request: { status: 200, - data: { message: 'Mock response' }, + statusText: 'OK', headers: { 'content-type': 'application/json' }, + body: { message: 'Mock response' }, + ok: true, + durationMs: 42, }, search_contacts: { contacts: [ @@ -182,11 +187,19 @@ export function generateMockOutput( posts: [ { id: 'mock_post_1', + platform: 'reddit', + url: 'https://reddit.com/r/technology/mock', + text: 'Mock Reddit post content', title: 'Mock Reddit Post', - author: 'mock_user', + authorName: 'mock_user', + authorHandle: 'u/mock_user', + authorUrl: 'https://reddit.com/u/mock_user', subreddit: 'technology', - score: 150, - url: 'https://reddit.com/r/technology/mock', + engagement: { + likes: 150, + comments: 25, + shares: 10, + }, createdAt: new Date().toISOString(), }, ], @@ -195,26 +208,52 @@ export function generateMockOutput( posts: [ { id: 'mock_tweet_1', + platform: 'twitter', + url: 'https://twitter.com/mockuser/status/mock_tweet_1', text: 'Mock tweet content', - author: 'mockuser', - likes: 50, - retweets: 10, + authorName: 'Mock User', + authorHandle: '@mockuser', + authorUrl: 'https://twitter.com/mockuser', + authorFollowers: 1000, + engagement: { + likes: 50, + comments: 5, + shares: 10, + views: 500, + }, createdAt: new Date().toISOString(), }, ], }, social_keyword_generator: { - keywords: ['ai', 'machine learning', 'automation', 'workflow'], - hashtags: ['#AI', '#ML', '#Automation'], + topic: 'AI automation', + twitter: { + keywords: ['ai', 'machine learning', 'automation'], + searchQuery: 'ai OR "machine learning" OR automation', + }, + reddit: { + keywords: ['artificial intelligence', 'ML', 'workflow automation'], + }, + linkedin: { + keywords: ['AI', 'enterprise automation'], + searchQueries: ['AI automation tools', 'machine learning workflow'], + }, + allKeywords: ['ai', 'machine learning', 'automation', 'workflow'], }, draft_emails: { - drafts: [ + emails: [ { - to: 'john.doe@example.com', + id: 'draft-mock-1', + toEmail: 'john.doe@example.com', + toName: 'John Doe', + toCompany: 'Example Corp', + toTitle: 'CTO', subject: 'Mock Email Subject', body: 'This is a mock email body for testing purposes.', + status: 'draft', }, ], + draftedCount: 1, }, };