5
5
6
6
import * as assert from 'assert'
7
7
import { Ec2InstanceNode } from '../../../ec2/explorer/ec2InstanceNode'
8
- import { Ec2Instance , getNameOfInstance } from '../../../shared/clients/ec2Client'
8
+ import { Ec2Client , Ec2Instance , getNameOfInstance } from '../../../shared/clients/ec2Client'
9
+ import { Ec2ParentNode } from '../../../ec2/explorer/ec2ParentNode'
9
10
10
11
describe ( 'ec2InstanceNode' , function ( ) {
11
12
let testNode : Ec2InstanceNode
12
13
let testInstance : Ec2Instance
14
+ const testRegion = 'testRegion'
15
+ const testPartition = 'testPartition'
13
16
14
17
before ( function ( ) {
15
18
testInstance = {
@@ -20,9 +23,11 @@ describe('ec2InstanceNode', function () {
20
23
Value : 'testName' ,
21
24
} ,
22
25
] ,
26
+ status : 'testing' ,
23
27
}
24
-
25
- testNode = new Ec2InstanceNode ( 'testRegion' , 'testPartition' , testInstance )
28
+ const testClient = new Ec2Client ( '' )
29
+ const testParentNode = new Ec2ParentNode ( testRegion , testPartition , testClient )
30
+ testNode = new Ec2InstanceNode ( testParentNode , testClient , 'testRegion' , 'testPartition' , testInstance )
26
31
} )
27
32
28
33
it ( 'instantiates without issue' , async function ( ) {
@@ -41,13 +46,17 @@ describe('ec2InstanceNode', function () {
41
46
assert . strictEqual ( testNode . name , getNameOfInstance ( testInstance ) )
42
47
} )
43
48
44
- it ( 'initializes the tooltip' , async function ( ) {
45
- assert . strictEqual ( testNode . tooltip , `${ testNode . name } \n${ testNode . InstanceId } \n${ testNode . arn } ` )
46
- } )
47
-
48
49
it ( 'has no children' , async function ( ) {
49
50
const childNodes = await testNode . getChildren ( )
50
51
assert . ok ( childNodes )
51
52
assert . strictEqual ( childNodes . length , 0 , 'Expected node to have no children' )
52
53
} )
54
+
55
+ it ( 'has an EC2ParentNode as parent' , async function ( ) {
56
+ assert . ok ( testNode . parent instanceof Ec2ParentNode )
57
+ } )
58
+
59
+ it ( 'intializes the client' , async function ( ) {
60
+ assert . ok ( testNode . client instanceof Ec2Client )
61
+ } )
53
62
} )
0 commit comments