@@ -269,6 +269,52 @@ test.serial('redirect to v2 protocol if openfn.yaml is present', async (t) => {
269269 ) ;
270270} ) ;
271271
272+ test . serial ( 'deploy a v2 spec file' , async ( t ) => {
273+ const testProjectV2 = `
274+ name: test-project
275+ schema_version: '4.0'
276+ workflows:
277+ - id: my-workflow
278+ name: My Workflow
279+ start: webhook
280+ steps:
281+ - id: webhook
282+ type: webhook
283+ enabled: true
284+ next:
285+ my-job: {}
286+ - id: my-job
287+ name: My Job
288+ expression: 'fn(s => s)'
289+ adaptor: '@openfn/language-common@latest'
290+ ` . trim ( ) ;
291+
292+ await fs . writeFile ( path . join ( tmpDir , 'project.yaml' ) , testProjectV2 ) ;
293+
294+ t . is ( Object . keys ( server . state . projects ) . length , 0 ) ;
295+
296+ const { stdout, stderr } = await run (
297+ `openfn deploy \
298+ --project-path ${ tmpDir } /project.yaml \
299+ --state-path ${ tmpDir } /.state.json \
300+ --no-confirm \
301+ --log-json \
302+ -l debug`
303+ ) ;
304+
305+ t . falsy ( stderr ) ;
306+
307+ const logs = extractLogs ( stdout ) ;
308+ assertLog ( t , logs , / v 2 s p e c / i) ;
309+ assertLog ( t , logs , / D e p l o y e d / ) ;
310+
311+ t . is ( Object . keys ( server . state . projects ) . length , 1 ) ;
312+ const [ project ] = Object . values ( server . state . projects ) as any [ ] ;
313+ t . is ( project . name , 'test-project' ) ;
314+ const [ workflow ] = Object . values ( project . workflows ) as any [ ] ;
315+ t . is ( workflow . name , 'My Workflow' ) ;
316+ } ) ;
317+
272318test . serial ( 'deploy then pull, changes one workflow, deploy' , async ( t ) => {
273319 t . is ( Object . keys ( server . state . projects ) . length , 0 ) ;
274320
0 commit comments