@@ -33,7 +33,7 @@ describe('workflows', () => {
3333 const resetState = ( ) => {
3434 store . state . workflows . lookup = { }
3535 store . state . workflows . workflow = {
36- tree : { } ,
36+ tree : [ ] ,
3737 lookup : { }
3838 }
3939 store . state . workflows . workflows = [ ]
@@ -44,7 +44,7 @@ describe('workflows', () => {
4444 describe ( 'State' , ( ) => {
4545 it ( 'should start with empty lookup, empty workflow, no workflows, and no workflow name' , ( ) => {
4646 expect ( Object . keys ( store . state . workflows . lookup ) . length ) . to . deep . equal ( 0 )
47- expect ( store . state . workflows . workflow ) . to . deep . equal ( { tree : { } , lookup : { } } )
47+ expect ( store . state . workflows . workflow ) . to . deep . equal ( { tree : [ ] , lookup : { } } )
4848 expect ( store . state . workflows . workflows . length ) . to . equal ( 0 )
4949 expect ( store . state . workflows . workflowName ) . to . equal ( null )
5050 } )
@@ -79,38 +79,37 @@ describe('workflows', () => {
7979 store . commit ( 'workflows/SET_WORKFLOW_NAME' , workflowName )
8080 expect ( store . state . workflows . workflowName ) . to . equal ( workflowName )
8181 } )
82- it ( 'should set workflow ' , ( ) => {
82+ it ( 'should set gscan ' , ( ) => {
8383 const workflow = {
84- tree : {
85- test : 1
86- } ,
84+ tree : [
85+ {
86+ test : 1
87+ }
88+ ] ,
8789 lookup : {
8890 test : 1
8991 }
9092 }
91- store . commit ( 'workflows/SET_WORKFLOW' , workflow )
92- expect ( store . state . workflows . workflow ) . to . deep . equal ( workflow )
93- } )
94- it ( 'should set lookup' , ( ) => {
95- const lookup = {
96- test : 1
97- }
98- store . commit ( 'workflows/SET_LOOKUP' , lookup )
99- expect ( store . state . workflows . lookup ) . to . deep . equal ( lookup )
93+ store . commit ( 'workflows/SET_GSCAN' , workflow )
94+ expect ( store . state . workflows . gscan ) . to . deep . equal ( workflow )
10095 } )
101- it ( 'should clear workflow ' , ( ) => {
96+ it ( 'should clear gscan ' , ( ) => {
10297 const workflow = {
103- tree : {
104- test : 1
105- } ,
98+ tree : [
99+ {
100+ test : 1
101+ }
102+ ] ,
106103 lookup : {
107104 test : 1
108105 }
109106 }
110- store . commit ( 'workflows/SET_WORKFLOW' , workflow )
111- expect ( store . state . workflows . workflow ) . to . deep . equal ( workflow )
112- store . commit ( 'workflows/CLEAR_WORKFLOW' , workflow )
113- expect ( store . state . workflows . workflow ) . to . not . deep . equal ( workflow )
107+ store . commit ( 'workflows/SET_GSCAN' , workflow )
108+ expect ( store . state . workflows . gscan . tree . length ) . to . equal ( 1 )
109+ expect ( Object . keys ( store . state . workflows . gscan . lookup ) . length ) . to . equal ( 1 )
110+ store . commit ( 'workflows/CLEAR_GSCAN' )
111+ expect ( store . state . workflows . gscan . tree . length ) . to . equal ( 0 )
112+ expect ( Object . keys ( store . state . workflows . gscan . lookup ) . length ) . to . equal ( 0 )
114113 } )
115114 } )
116115 describe ( 'Actions' , ( ) => {
@@ -119,14 +118,15 @@ describe('workflows', () => {
119118 deltas : {
120119 added : {
121120 workflow : {
122- id : 'test' ,
121+ id : 'cylc| test' ,
123122 status : 'test'
124123 }
125124 }
126125 }
127126 }
128127 store . dispatch ( 'workflows/applyWorkflowsDeltas' , data )
129- expect ( store . state . workflows . workflows . test ) . to . not . equal ( undefined )
128+ store . dispatch ( 'workflows/applyGScanDeltas' , data )
129+ expect ( store . state . workflows . workflows [ 'cylc|test' ] ) . to . not . equal ( undefined )
130130 } )
131131 it ( 'should clear workflows' , ( ) => {
132132 const workflows = {
@@ -150,52 +150,14 @@ describe('workflows', () => {
150150 deltas : {
151151 added : {
152152 workflow : {
153- id : 'test' ,
153+ id : 'cylc| test' ,
154154 status : 'test'
155155 }
156156 }
157157 }
158158 }
159- store . dispatch ( 'workflows/applyWorkflowDeltas' , data )
160- expect ( store . state . workflows . lookup . test ) . to . not . equal ( undefined )
161- } )
162- it ( 'should apply tree deltas' , ( ) => {
163- const data = {
164- deltas : {
165- added : {
166- workflow : {
167- id : 'test' ,
168- status : 'test'
169- }
170- }
171- }
172- }
173- store . dispatch ( 'workflows/applyWorkflowDeltas' , data )
174- store . dispatch ( 'workflows/applyTreeDeltas' , data )
175- expect ( store . state . workflows . workflow . tree . id ) . to . equal ( 'test' )
176- } )
177- it ( 'should clear lookup' , ( ) => {
178- const lookup = {
179- test : 1
180- }
181- store . commit ( 'workflows/SET_LOOKUP' , lookup )
182- expect ( store . state . workflows . lookup ) . to . deep . equal ( lookup )
183- store . dispatch ( 'workflows/clearWorkflow' )
184- expect ( store . state . workflows . lookup ) . to . not . deep . equal ( lookup )
185- } )
186- it ( 'should clear workflow (tree)' , ( ) => {
187- const workflow = {
188- tree : {
189- test : 1
190- } ,
191- lookup : {
192- test : 1
193- }
194- }
195- store . commit ( 'workflows/SET_WORKFLOW' , workflow )
196- expect ( store . state . workflows . workflow ) . to . deep . equal ( workflow )
197- store . dispatch ( 'workflows/clearTree' )
198- expect ( store . state . workflows . workflow ) . to . not . deep . equal ( workflow )
159+ store . dispatch ( 'workflows/applyGScanDeltas' , data )
160+ expect ( store . state . workflows . gscan . lookup [ 'cylc|test' ] ) . to . not . equal ( undefined )
199161 } )
200162 } )
201163} )
0 commit comments