@@ -22,7 +22,7 @@ describe('createEdgeFunction', () => {
2222 fs . rmSync ( tempDir , { recursive : true , force : true } ) ;
2323 } ) ;
2424
25- it ( 'should create all three files when none exist' , async ( ) => {
25+ it ( 'should create both files when none exist' , async ( ) => {
2626 const result = await createEdgeFunction ( {
2727 supabasePath,
2828 autoConfirm : true ,
@@ -36,23 +36,16 @@ describe('createEdgeFunction', () => {
3636
3737 // Verify all files exist
3838 const indexPath = path . join ( pgflowFunctionDir , 'index.ts' ) ;
39- const flowsPath = path . join ( pgflowFunctionDir , 'flows.ts' ) ;
4039 const denoJsonPath = path . join ( pgflowFunctionDir , 'deno.json' ) ;
4140
4241 expect ( fs . existsSync ( indexPath ) ) . toBe ( true ) ;
43- expect ( fs . existsSync ( flowsPath ) ) . toBe ( true ) ;
4442 expect ( fs . existsSync ( denoJsonPath ) ) . toBe ( true ) ;
4543
46- // Verify index.ts content
44+ // Verify index.ts content (inline flow registration, no flows.ts)
4745 const indexContent = fs . readFileSync ( indexPath , 'utf8' ) ;
4846 expect ( indexContent ) . toContain ( "import { ControlPlane } from '@pgflow/edge-worker'" ) ;
49- expect ( indexContent ) . toContain ( "import { flows } from './flows.ts'" ) ;
50- expect ( indexContent ) . toContain ( 'ControlPlane.serve(flows)' ) ;
51-
52- // Verify flows.ts content
53- const flowsContent = fs . readFileSync ( flowsPath , 'utf8' ) ;
54- expect ( flowsContent ) . toContain ( 'export const flows = [' ) ;
55- expect ( flowsContent ) . toContain ( '// Import your flows here' ) ;
47+ expect ( indexContent ) . toContain ( 'ControlPlane.serve([' ) ;
48+ expect ( indexContent ) . toContain ( '// Import your flows here' ) ;
5649
5750 // Verify deno.json content
5851 const denoJsonContent = fs . readFileSync ( denoJsonPath , 'utf8' ) ;
@@ -66,11 +59,9 @@ describe('createEdgeFunction', () => {
6659 fs . mkdirSync ( pgflowFunctionDir , { recursive : true } ) ;
6760
6861 const indexPath = path . join ( pgflowFunctionDir , 'index.ts' ) ;
69- const flowsPath = path . join ( pgflowFunctionDir , 'flows.ts' ) ;
7062 const denoJsonPath = path . join ( pgflowFunctionDir , 'deno.json' ) ;
7163
7264 fs . writeFileSync ( indexPath , '// existing content' ) ;
73- fs . writeFileSync ( flowsPath , '// existing content' ) ;
7465 fs . writeFileSync ( denoJsonPath , '// existing content' ) ;
7566
7667 const result = await createEdgeFunction ( {
@@ -83,7 +74,6 @@ describe('createEdgeFunction', () => {
8374
8475 // Verify files still exist with original content
8576 expect ( fs . readFileSync ( indexPath , 'utf8' ) ) . toBe ( '// existing content' ) ;
86- expect ( fs . readFileSync ( flowsPath , 'utf8' ) ) . toBe ( '// existing content' ) ;
8777 expect ( fs . readFileSync ( denoJsonPath , 'utf8' ) ) . toBe ( '// existing content' ) ;
8878 } ) ;
8979
@@ -92,7 +82,6 @@ describe('createEdgeFunction', () => {
9282 fs . mkdirSync ( pgflowFunctionDir , { recursive : true } ) ;
9383
9484 const indexPath = path . join ( pgflowFunctionDir , 'index.ts' ) ;
95- const flowsPath = path . join ( pgflowFunctionDir , 'flows.ts' ) ;
9685 const denoJsonPath = path . join ( pgflowFunctionDir , 'deno.json' ) ;
9786
9887 // Only create index.ts
@@ -103,19 +92,15 @@ describe('createEdgeFunction', () => {
10392 autoConfirm : true ,
10493 } ) ;
10594
106- // Should return true because some files were created
95+ // Should return true because deno.json was created
10796 expect ( result ) . toBe ( true ) ;
10897
10998 // Verify index.ts was not modified
11099 expect ( fs . readFileSync ( indexPath , 'utf8' ) ) . toBe ( '// existing content' ) ;
111100
112- // Verify flows.ts and deno.json were created
113- expect ( fs . existsSync ( flowsPath ) ) . toBe ( true ) ;
101+ // Verify deno.json was created
114102 expect ( fs . existsSync ( denoJsonPath ) ) . toBe ( true ) ;
115103
116- const flowsContent = fs . readFileSync ( flowsPath , 'utf8' ) ;
117- expect ( flowsContent ) . toContain ( 'export const flows = [' ) ;
118-
119104 const denoJsonContent = fs . readFileSync ( denoJsonPath , 'utf8' ) ;
120105 expect ( denoJsonContent ) . toContain ( '"imports"' ) ;
121106 } ) ;
@@ -138,7 +123,6 @@ describe('createEdgeFunction', () => {
138123
139124 // Verify files exist
140125 expect ( fs . existsSync ( path . join ( pgflowFunctionDir , 'index.ts' ) ) ) . toBe ( true ) ;
141- expect ( fs . existsSync ( path . join ( pgflowFunctionDir , 'flows.ts' ) ) ) . toBe ( true ) ;
142126 expect ( fs . existsSync ( path . join ( pgflowFunctionDir , 'deno.json' ) ) ) . toBe ( true ) ;
143127 } ) ;
144128
0 commit comments