@@ -50,11 +50,12 @@ describe('ec2ParentNode', function () {
50
50
51
51
beforeEach ( function ( ) {
52
52
instances = [
53
- { name : 'firstOne' , InstanceId : '0' , status : 'pending ' } ,
53
+ { name : 'firstOne' , InstanceId : '0' , status : 'running ' } ,
54
54
{ name : 'secondOne' , InstanceId : '1' , status : 'stopped' } ,
55
55
]
56
56
57
57
testNode = new Ec2ParentNode ( testRegion , testPartition , createClient ( ) )
58
+ refreshStub . resetHistory ( )
58
59
} )
59
60
60
61
it ( 'returns placeholder node if no children are present' , async function ( ) {
@@ -116,18 +117,34 @@ describe('ec2ParentNode', function () {
116
117
} )
117
118
118
119
it ( 'adds pending nodes to the polling nodes set' , async function ( ) {
120
+ instances = [
121
+ { name : 'firstOne' , InstanceId : '0' , status : 'pending' } ,
122
+ { name : 'secondOne' , InstanceId : '1' , status : 'stopped' } ,
123
+ { name : 'thirdOne' , InstanceId : '2' , status : 'running' } ,
124
+ ]
119
125
await testNode . updateChildren ( )
120
126
assert . strictEqual ( testNode . pollingNodes . size , 1 )
121
127
} )
122
128
123
129
it ( 'refreshes explorer when timer goes off' , async function ( ) {
130
+ instances = [
131
+ { name : 'firstOne' , InstanceId : '0' , status : 'pending' } ,
132
+ { name : 'secondOne' , InstanceId : '1' , status : 'stopped' } ,
133
+ { name : 'thirdOne' , InstanceId : '2' , status : 'running' } ,
134
+ ]
124
135
await testNode . updateChildren ( )
125
136
await clock . tickAsync ( 6000 )
126
137
sinon . assert . calledOn ( refreshStub , testNode )
127
138
} )
128
139
129
140
it ( 'stops timer once polling nodes are empty' , async function ( ) {
141
+ instances = [
142
+ { name : 'firstOne' , InstanceId : '0' , status : 'pending' } ,
143
+ { name : 'secondOne' , InstanceId : '1' , status : 'stopped' } ,
144
+ { name : 'thirdOne' , InstanceId : '2' , status : 'running' } ,
145
+ ]
130
146
await testNode . updateChildren ( )
147
+
131
148
assert . strictEqual ( testNode . isPolling ( ) , true )
132
149
testNode . pollingNodes . delete ( '0' )
133
150
await clock . tickAsync ( 6000 )
0 commit comments