1717
1818import { expect } from 'chai'
1919import WorkflowState from '@/model/WorkflowState.model'
20- import applyWorkflowsDeltas from '@/components/cylc/gscan/deltas'
20+ import applyGScanDeltas from '@/components/cylc/gscan/deltas'
2121
2222describe ( 'GScan component' , ( ) => {
23- let workflows
23+ let gscan
2424 let newWorkflow
2525 beforeEach ( ( ) => {
26- workflows = { }
26+ gscan = {
27+ lookup : { } ,
28+ tree : [ ]
29+ }
2730 newWorkflow = {
2831 id : 'cylc|test' ,
2932 status : WorkflowState . PAUSED
@@ -39,8 +42,9 @@ describe('GScan component', () => {
3942 }
4043 }
4144 }
42- applyWorkflowsDeltas ( data , workflows )
43- expect ( workflows [ newWorkflow . id ] ) . to . not . equal ( undefined )
45+ applyGScanDeltas ( data , gscan , { } )
46+ expect ( gscan . lookup [ newWorkflow . id ] ) . to . not . equal ( undefined )
47+ expect ( gscan . tree [ 0 ] ) . to . not . equal ( undefined )
4448 } )
4549 } )
4650 describe ( 'Updated' , ( ) => {
@@ -52,8 +56,8 @@ describe('GScan component', () => {
5256 }
5357 }
5458 }
55- applyWorkflowsDeltas ( data , workflows )
56- expect ( workflows [ newWorkflow . id ] . status ) . to . equal ( WorkflowState . PAUSED )
59+ applyGScanDeltas ( data , gscan , { } )
60+ expect ( gscan . lookup [ newWorkflow . id ] . node . status ) . to . equal ( WorkflowState . PAUSED )
5761 newWorkflow . status = WorkflowState . STOPPED
5862 const updateData = {
5963 deltas : {
@@ -62,8 +66,8 @@ describe('GScan component', () => {
6266 }
6367 }
6468 }
65- applyWorkflowsDeltas ( updateData , workflows )
66- expect ( workflows [ newWorkflow . id ] . status ) . to . equal ( WorkflowState . STOPPED )
69+ applyGScanDeltas ( updateData , gscan , { } )
70+ expect ( gscan . lookup [ newWorkflow . id ] . node . status ) . to . equal ( WorkflowState . STOPPED )
6771 } )
6872 } )
6973 describe ( 'Pruned' , ( ) => {
@@ -75,17 +79,17 @@ describe('GScan component', () => {
7579 }
7680 }
7781 }
78- applyWorkflowsDeltas ( data , workflows )
79- expect ( workflows [ newWorkflow . id ] ) . to . not . equal ( undefined )
82+ applyGScanDeltas ( data , gscan , { } )
83+ expect ( gscan . lookup [ newWorkflow . id ] ) . to . not . equal ( undefined )
8084 const prunedData = {
8185 deltas : {
8286 pruned : {
8387 workflow : newWorkflow . id
8488 }
8589 }
8690 }
87- applyWorkflowsDeltas ( prunedData , workflows )
88- expect ( workflows [ newWorkflow . id ] ) . to . equal ( undefined )
91+ applyGScanDeltas ( prunedData , gscan , { } )
92+ expect ( gscan . lookup [ newWorkflow . id ] ) . to . equal ( undefined )
8993 } )
9094 } )
9195 } )
0 commit comments