@@ -25,15 +25,15 @@ describe('addRegionCommand', function () {
2525 DBClusterMembers : [ { IsClusterWriter : true } ] ,
2626 }
2727 let docdb : DocumentDBClient
28- let node : DBClusterNode | DBGlobalClusterNode
29- let sandbox : sinon . SinonSandbox
28+ let testNode : DBClusterNode | DBGlobalClusterNode
29+ let sinonSandbox : sinon . SinonSandbox
3030 let spyExecuteCommand : sinon . SinonSpy
3131
3232 beforeEach ( function ( ) {
33- sandbox = sinon . createSandbox ( )
34- spyExecuteCommand = sandbox . spy ( vscode . commands , 'executeCommand' )
35- sandbox . stub ( globals . regionProvider , 'isServiceInRegion' ) . returns ( true )
36- sandbox . stub ( globals . regionProvider , 'getRegions' ) . returns ( [
33+ sinonSandbox = sinon . createSandbox ( )
34+ spyExecuteCommand = sinonSandbox . spy ( vscode . commands , 'executeCommand' )
35+ sinonSandbox . stub ( globals . regionProvider , 'isServiceInRegion' ) . returns ( true )
36+ sinonSandbox . stub ( globals . regionProvider , 'getRegions' ) . returns ( [
3737 { id : 'us-test-1' , name : 'Test Region 1' } ,
3838 { id : 'us-test-2' , name : 'Test Region 2' } ,
3939 ] )
@@ -44,34 +44,34 @@ describe('addRegionCommand', function () {
4444 . stub ( )
4545 . resolves ( [ { DBInstanceClass : 'db.r5.large' , StorageType : DBStorageType . Standard } ] )
4646
47- sandbox . stub ( DefaultDocumentDBClient , 'create' ) . returns ( docdb )
47+ sinonSandbox . stub ( DefaultDocumentDBClient , 'create' ) . returns ( docdb )
4848
4949 cluster . DBClusterMembers = [ { IsClusterWriter : true } ]
5050 const parentNode = new DocumentDBNode ( docdb )
51- node = new DBClusterNode ( parentNode , cluster , docdb )
52- } )
5351
52+ testNode = new DBClusterNode ( parentNode , cluster , docdb )
53+ } )
5454 afterEach ( function ( ) {
55- sandbox . restore ( )
55+ sinonSandbox . restore ( )
5656 getTestWindow ( ) . dispose ( )
5757 } )
58-
5958 function setupWizard ( ) {
6059 getTestWindow ( ) . onDidShowInputBox ( ( input ) => {
61- let value : string
60+ let val : string
61+
6262 if ( input . prompt ?. includes ( 'global' ) ) {
63- value = globalClusterName
63+ val = globalClusterName
6464 } else if ( input . prompt ?. includes ( 'cluster name' ) ) {
65- value = clusterName
65+ val = clusterName
6666 } else {
67- value = ''
67+ val = ''
6868 }
69- input . acceptValue ( value )
69+ input . acceptValue ( val )
7070 } )
7171
72- getTestWindow ( ) . onDidShowQuickPick ( async ( picker ) => {
73- await picker . untilReady ( )
74- picker . acceptItem ( picker . items [ 0 ] )
72+ getTestWindow ( ) . onDidShowQuickPick ( async ( testQuickPicker ) => {
73+ await testQuickPicker . untilReady ( )
74+ testQuickPicker . acceptItem ( testQuickPicker . items [ 0 ] )
7575 } )
7676 }
7777
@@ -83,14 +83,15 @@ describe('addRegionCommand', function () {
8383 const createClusterStub = sinon . stub ( ) . resolves ( {
8484 DBClusterIdentifier : clusterName ,
8585 } )
86- const createInstanceStub = sinon . stub ( ) . resolves ( )
86+ const createInstanceSinonStub = sinon . stub ( ) . resolves ( )
8787 docdb . createGlobalCluster = createGlobalClusterStub
8888 docdb . createCluster = createClusterStub
89- docdb . createInstance = createInstanceStub
89+ docdb . createInstance = createInstanceSinonStub
90+
9091 setupWizard ( )
9192
9293 // act
93- await addRegion ( node )
94+ await addRegion ( testNode )
9495
9596 // assert
9697 getTestWindow ( ) . getFirstMessage ( ) . assertInfo ( 'Region added' )
@@ -110,9 +111,8 @@ describe('addRegionCommand', function () {
110111 } )
111112 )
112113 )
113-
114114 assert (
115- createInstanceStub . calledOnceWith (
115+ createInstanceSinonStub . calledOnceWith (
116116 sinon . match ( {
117117 Engine : 'docdb' ,
118118 DBClusterIdentifier : clusterName ,
@@ -122,7 +122,7 @@ describe('addRegionCommand', function () {
122122 )
123123 )
124124
125- sandbox . assert . calledWith ( spyExecuteCommand , 'aws.refreshAwsExplorerNode' , node . parent )
125+ sinonSandbox . assert . calledWith ( spyExecuteCommand , 'aws.refreshAwsExplorerNode' , testNode . parent )
126126
127127 assertTelemetry ( 'docdb_addRegion' , { result : 'Succeeded' } )
128128 } )
@@ -132,12 +132,12 @@ describe('addRegionCommand', function () {
132132 const createGlobalClusterStub = sinon . stub ( ) . resolves ( {
133133 GlobalClusterIdentifier : globalClusterName ,
134134 } )
135- const createClusterStub = sinon . stub ( ) . resolves ( {
135+ const createClusterSinonStub = sinon . stub ( ) . resolves ( {
136136 DBClusterIdentifier : clusterName ,
137137 } )
138138 const createInstanceStub = sinon . stub ( ) . resolves ( )
139139 docdb . createGlobalCluster = createGlobalClusterStub
140- docdb . createCluster = createClusterStub
140+ docdb . createCluster = createClusterSinonStub
141141 docdb . createInstance = createInstanceStub
142142 setupWizard ( )
143143
@@ -146,18 +146,18 @@ describe('addRegionCommand', function () {
146146 GlobalClusterMembers : [ ] ,
147147 Status : 'available' ,
148148 }
149- node = new DBGlobalClusterNode ( new DocumentDBNode ( docdb ) , globalCluster , new Map ( ) , docdb )
149+ testNode = new DBGlobalClusterNode ( new DocumentDBNode ( docdb ) , globalCluster , new Map ( ) , docdb )
150150
151151 // act
152- await addRegion ( node )
152+ await addRegion ( testNode )
153153
154154 // assert
155155 getTestWindow ( ) . getFirstMessage ( ) . assertInfo ( 'Region added' )
156156
157157 assert ( createGlobalClusterStub . notCalled )
158158
159159 assert (
160- createClusterStub . calledOnceWith (
160+ createClusterSinonStub . calledOnceWith (
161161 sinon . match ( {
162162 DBClusterIdentifier : clusterName ,
163163 GlobalClusterIdentifier : globalClusterName ,
@@ -175,8 +175,7 @@ describe('addRegionCommand', function () {
175175 } )
176176 )
177177 )
178-
179- sandbox . assert . calledWith ( spyExecuteCommand , 'aws.refreshAwsExplorerNode' , node )
178+ sinonSandbox . assert . calledWith ( spyExecuteCommand , 'aws.refreshAwsExplorerNode' , testNode )
180179
181180 assertTelemetry ( 'docdb_addRegion' , { result : 'Succeeded' } )
182181 } )
@@ -188,7 +187,7 @@ describe('addRegionCommand', function () {
188187 getTestWindow ( ) . onDidShowQuickPick ( ( input ) => input . hide ( ) )
189188
190189 // act
191- await assert . rejects ( addRegion ( node ) )
190+ await assert . rejects ( addRegion ( testNode ) )
192191
193192 // assert
194193 assert ( stub . notCalled )
@@ -205,7 +204,7 @@ describe('addRegionCommand', function () {
205204 setupWizard ( )
206205
207206 // act
208- await assert . rejects ( addRegion ( node ) )
207+ await assert . rejects ( addRegion ( testNode ) )
209208
210209 // assert
211210 getTestWindow ( )
@@ -217,12 +216,12 @@ describe('addRegionCommand', function () {
217216
218217 it ( 'shows a warning when the cluster has no instances' , async function ( ) {
219218 // arrange
220- const clusterNode = node as DBClusterNode
219+ const clusterNode = testNode as DBClusterNode
221220 clusterNode . cluster . DBClusterMembers = [ ]
222221 setupWizard ( )
223222
224223 // act
225- await assert . rejects ( addRegion ( node ) )
224+ await assert . rejects ( addRegion ( testNode ) )
226225
227226 // assert
228227 getTestWindow ( )
@@ -234,12 +233,12 @@ describe('addRegionCommand', function () {
234233
235234 it ( 'shows a warning when the cluster has an unsupported instance class' , async function ( ) {
236235 // arrange
237- const clusterNode = node as DBClusterNode
236+ const clusterNode = testNode as DBClusterNode
238237 clusterNode . instances = [ { DBInstanceClass : 'db.t3.medium' } ]
239238 setupWizard ( )
240239
241240 // act
242- await assert . rejects ( addRegion ( node ) )
241+ await assert . rejects ( addRegion ( testNode ) )
243242
244243 // assert
245244 getTestWindow ( )
0 commit comments