Skip to content

Commit bf25145

Browse files
committed
add another test for the update functionality
1 parent 2b749a3 commit bf25145

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test/ec2/explorer/ec2InstanceNode.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('ec2InstanceNode', function () {
2121

2222
before(function () {
2323
testInstance = {
24-
InstanceId: 'running-testId',
24+
InstanceId: 'testId',
2525
Tags: [
2626
{
2727
Key: 'Name',
@@ -35,6 +35,10 @@ describe('ec2InstanceNode', function () {
3535
testNode = new Ec2InstanceNode(testParentNode, testClient, 'testRegion', 'testPartition', testInstance)
3636
})
3737

38+
this.beforeEach(function () {
39+
testNode.updateInstance(testInstance)
40+
})
41+
3842
it('instantiates without issue', async function () {
3943
assert.ok(testNode)
4044
})
@@ -78,4 +82,10 @@ describe('ec2InstanceNode', function () {
7882
testNode.updateInstance(pendingInstance)
7983
assert.strictEqual(testNode.contextValue, Ec2InstancePendingContext)
8084
})
85+
86+
it('updates label with new instance', async function () {
87+
const newIdInstance = { ...testInstance, InstanceId: 'testId2' }
88+
testNode.updateInstance(newIdInstance)
89+
assert.strictEqual(testNode.label, `${getNameOfInstance(newIdInstance)} (${newIdInstance.InstanceId})`)
90+
})
8191
})

0 commit comments

Comments
 (0)