@@ -8,6 +8,7 @@ import { FlowRunStatus, FlowStepStatus } from '../../src/lib/types.js';
88import { PgflowSqlClient } from '@pgflow/core' ;
99import { readAndStart } from '../helpers/polling.js' ;
1010import { cleanupFlow } from '../helpers/cleanup.js' ;
11+ import { log } from '../helpers/debug.js' ;
1112
1213describe ( 'Happy Path E2E Integration' , ( ) => {
1314 it (
@@ -40,7 +41,7 @@ describe('Happy Path E2E Integration', () => {
4041
4142 // Listen to all events for verification
4243 run . on ( '*' , ( event ) => {
43- console . log ( 'Run event received:' , event ) ;
44+ log ( 'Run event received:' , event ) ;
4445 receivedRunEvents . push ( event ) ;
4546 } ) ;
4647
@@ -49,17 +50,17 @@ describe('Happy Path E2E Integration', () => {
4950 const saveStep = run . step ( 'save' ) ;
5051
5152 fetchStep . on ( '*' , ( event ) => {
52- console . log ( 'Fetch step event:' , event ) ;
53+ log ( 'Fetch step event:' , event ) ;
5354 receivedStepEvents . push ( { step : 'fetch' , event } ) ;
5455 } ) ;
5556
5657 processStep . on ( '*' , ( event ) => {
57- console . log ( 'Process step event:' , event ) ;
58+ log ( 'Process step event:' , event ) ;
5859 receivedStepEvents . push ( { step : 'process' , event } ) ;
5960 } ) ;
6061
6162 saveStep . on ( '*' , ( event ) => {
62- console . log ( 'Save step event:' , event ) ;
63+ log ( 'Save step event:' , event ) ;
6364 receivedStepEvents . push ( { step : 'save' , event } ) ;
6465 } ) ;
6566
@@ -68,7 +69,7 @@ describe('Happy Path E2E Integration', () => {
6869 expect ( run . input ) . toEqual ( input ) ;
6970
7071 // Step 1: Complete fetch step
71- console . log ( '=== Step 1: Completing fetch step ===' ) ;
72+ log ( '=== Step 1: Completing fetch step ===' ) ;
7273 let tasks = await readAndStart ( sql , sqlClient , testFlow . slug , 1 , 5 ) ;
7374 expect ( tasks ) . toHaveLength ( 1 ) ;
7475 expect ( tasks [ 0 ] . step_slug ) . toBe ( 'fetch' ) ;
@@ -83,7 +84,7 @@ describe('Happy Path E2E Integration', () => {
8384 expect ( fetchStep . output ) . toEqual ( fetchOutput ) ;
8485
8586 // Step 2: Complete process step (should now be available)
86- console . log ( '=== Step 2: Completing process step ===' ) ;
87+ log ( '=== Step 2: Completing process step ===' ) ;
8788 tasks = await readAndStart ( sql , sqlClient , testFlow . slug , 1 , 5 ) ;
8889 expect ( tasks ) . toHaveLength ( 1 ) ;
8990 expect ( tasks [ 0 ] . step_slug ) . toBe ( 'process' ) ;
@@ -103,28 +104,28 @@ describe('Happy Path E2E Integration', () => {
103104 expect ( processStep . output ) . toEqual ( processOutput ) ;
104105
105106 // Step 3: Complete save step (should now be available)
106- console . log ( '=== Step 3: Completing save step ===' ) ;
107+ log ( '=== Step 3: Completing save step ===' ) ;
107108
108109 // Debug: Check dependencies in database
109110 const deps = await sql `
110111 SELECT * FROM pgflow.deps WHERE flow_slug = ${ testFlow . slug }
111112 ORDER BY dep_slug, step_slug
112113 ` ;
113- console . log ( 'Dependencies in database:' , deps ) ;
114+ log ( 'Dependencies in database:' , deps ) ;
114115
115116 // Debug: Check step_tasks status
116117 const stepTasks = await sql `
117118 SELECT step_slug, status, output FROM pgflow.step_tasks
118119 WHERE run_id = ${ run . run_id } ::uuid
119120 ORDER BY step_slug
120121 ` ;
121- console . log ( 'Step tasks status:' , stepTasks ) ;
122+ log ( 'Step tasks status:' , stepTasks ) ;
122123
123124 tasks = await readAndStart ( sql , sqlClient , testFlow . slug , 1 , 5 ) ;
124125 expect ( tasks ) . toHaveLength ( 1 ) ;
125126 expect ( tasks [ 0 ] . step_slug ) . toBe ( 'save' ) ;
126127
127- console . log ( 'Save task input:' , JSON . stringify ( tasks [ 0 ] . input , null , 2 ) ) ;
128+ log ( 'Save task input:' , JSON . stringify ( tasks [ 0 ] . input , null , 2 ) ) ;
128129
129130 expect ( tasks [ 0 ] . input . run ) . toEqual ( input ) ;
130131 expect ( tasks [ 0 ] . input . process ) . toEqual ( processOutput ) ;
@@ -150,9 +151,9 @@ describe('Happy Path E2E Integration', () => {
150151 expect ( run . output ) . toEqual ( { save : saveOutput } ) ; // Final step output becomes run output
151152
152153 // Verify we received realtime events
153- console . log ( '=== Event Verification ===' ) ;
154- console . log ( 'Total run events received:' , receivedRunEvents . length ) ;
155- console . log ( 'Total step events received:' , receivedStepEvents . length ) ;
154+ log ( '=== Event Verification ===' ) ;
155+ log ( 'Total run events received:' , receivedRunEvents . length ) ;
156+ log ( 'Total step events received:' , receivedStepEvents . length ) ;
156157
157158 // Should have received at least the completion event
158159 // Note: run:started event may fire before listeners are established
@@ -183,7 +184,7 @@ describe('Happy Path E2E Integration', () => {
183184 const remainingTasks = await readAndStart ( sql , sqlClient , testFlow . slug , 1 , 1 ) ;
184185 expect ( remainingTasks ) . toHaveLength ( 0 ) ;
185186
186- console . log ( '=== Happy Path E2E Test Completed Successfully ===' ) ;
187+ log ( '=== Happy Path E2E Test Completed Successfully ===' ) ;
187188 await supabaseClient . removeAllChannels ( ) ;
188189 } ) ,
189190 30000 // Allow extra time for 3-step completion
0 commit comments