Skip to content

Commit 14b19c2

Browse files
committed
expect(workflow.run).toBeFunction() if not json-serialized
1 parent 8ad5c8d commit 14b19c2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/BatchProcessor.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ describe('BatchProcessor', () => {
7878
})
7979

8080
let { workflow } = await seneca.post('aim:foo,color:red')
81+
82+
8183
out = await process(workflow, ctx, out)
8284

8385
await wait(111)
@@ -104,6 +106,7 @@ describe('BatchProcessor', () => {
104106
}
105107
]
106108
}))
109+
expect(workflow.run).toBeInstanceOf(Function)
107110

108111
expect(ctx.result$).toEqual([
109112
{
@@ -225,6 +228,9 @@ describe('BatchProcessor', () => {
225228
}
226229
]
227230
}))
231+
expect(workflow.run).toBeInstanceOf(Function)
232+
// NOTE: Workflow can be processed via run but "process" below is recommeded since json can't serialize functions
233+
// out = await workflow.run()
228234

229235
out = await process(workflow, ctx, out)
230236

@@ -254,6 +260,7 @@ describe('BatchProcessor', () => {
254260
}
255261
}
256262
])
263+
257264
expect(out.run).toBeDefined()
258265
expect(out.batch).toBeDefined()
259266

@@ -308,6 +315,7 @@ describe('BatchProcessor', () => {
308315
}
309316
]
310317
}))
318+
expect(workflow.run).toBeInstanceOf(Function)
311319

312320
out = await process(workflow, ctx, out)
313321

@@ -374,6 +382,7 @@ describe('BatchProcessor', () => {
374382
},
375383
send: []
376384
}))
385+
expect(workflow.run).toBeInstanceOf(Function)
377386

378387
/// OR, INSTEAD OF run: out = await process(workflow, ctx, out)
379388

0 commit comments

Comments
 (0)