@@ -65,7 +65,7 @@ describeMain('expertAutomations', () => {
6565 it ( 'should have supported actions' , ( ) => {
6666 const supportedActions = expertAutomations . supportedActions
6767 supportedActions . should . be . an . Object ( )
68- supportedActions . should . only . have . keys ( 'automation/get-nodes' , 'automation/select-nodes' , 'automation/open-node-edit' , 'automation/search' , 'automation/add-flow-tab' )
68+ supportedActions . should . only . have . keys ( 'automation/get-nodes' , 'automation/select-nodes' , 'automation/open-node-edit' , 'automation/search' , 'automation/add-flow-tab' , 'automation/import-flow' )
6969 } )
7070 it ( 'should have hasAction method' , ( ) => {
7171 expertAutomations . should . have . property ( 'hasAction' ) . which . is . a . Function ( )
@@ -310,7 +310,7 @@ describeMain('expertAutomations', () => {
310310 mockRED . view . importNodes . calledOnce . should . be . true ( )
311311 const args = mockRED . view . importNodes . firstCall . args
312312 args [ 0 ] . should . deepEqual ( [ { id : '' , type : 'tab' , label : 'My New Flow' , disabled : false , info : '' , env : [ ] } ] )
313- args [ 1 ] . should . deepEqual ( { generateIds : true , addFlow : false , notify : false } )
313+ args [ 1 ] . should . deepEqual ( { generateIds : true , addFlow : false , notify : false , touchImport : true } )
314314 result . should . have . property ( 'success' , true )
315315 result . should . have . property ( 'handled' , true )
316316 } )
@@ -323,5 +323,20 @@ describeMain('expertAutomations', () => {
323323 result . should . have . property ( 'success' , true )
324324 } )
325325 } )
326+ describe ( 'importFlow action' , ( ) => {
327+ it ( 'should import flow JSON' , async ( ) => {
328+ mockRED . view . importNodes = sinon . stub ( )
329+ mockRED . _ = sinon . stub ( ) . returns ( 'error' )
330+ const flowJson = JSON . stringify ( [ { id : 'n1' , type : 'inject' } ] )
331+ const result = { }
332+ await expertAutomations . invokeAction ( 'automation/import-flow' , {
333+ params : { flow : flowJson }
334+ } , result )
335+ mockRED . view . importNodes . calledOnce . should . be . true ( )
336+ const args = mockRED . view . importNodes . firstCall . args
337+ args [ 1 ] . should . have . property ( 'touchImport' , true )
338+ result . should . have . property ( 'success' , true )
339+ } )
340+ } )
326341 } )
327342} )
0 commit comments