@@ -27,8 +27,10 @@ describe('SMUS Explorer Activation', function () {
2727 let mockTreeView : sinon . SinonStubbedInstance < vscode . TreeView < any > >
2828 let mockTreeDataProvider : sinon . SinonStubbedInstance < ResourceTreeDataProvider >
2929 let mockSmusRootNode : sinon . SinonStubbedInstance < SageMakerUnifiedStudioRootNode >
30+ let mockProjectNode : any
3031 let createTreeViewStub : sinon . SinonStub
3132 let registerCommandStub : sinon . SinonStub
33+ let executeCommandSpy : sinon . SinonSpy
3234 let dataZoneDisposeStub : sinon . SinonStub
3335 let setupUserActivityMonitoringStub : sinon . SinonStub
3436
@@ -59,14 +61,20 @@ describe('SMUS Explorer Activation', function () {
5961 refresh : sinon . stub ( ) ,
6062 } as any
6163
64+ mockProjectNode = {
65+ getProject : sinon . stub ( ) . returns ( { id : 'test-project' , name : 'Test Project' } ) ,
66+ refreshNode : sinon . stub ( ) . resolves ( ) ,
67+ }
68+
6269 mockSmusRootNode = {
6370 getChildren : sinon . stub ( ) . resolves ( [ ] ) ,
64- getProjectSelectNode : sinon . stub ( ) . returns ( { refreshNode : sinon . stub ( ) . resolves ( ) } ) ,
71+ getProjectSelectNode : sinon . stub ( ) . returns ( mockProjectNode ) ,
6572 } as any
6673
6774 // Stub vscode APIs
6875 createTreeViewStub = sinon . stub ( vscode . window , 'createTreeView' ) . returns ( mockTreeView as any )
6976 registerCommandStub = sinon . stub ( vscode . commands , 'registerCommand' ) . returns ( { dispose : sinon . stub ( ) } as any )
77+ executeCommandSpy = sinon . spy ( vscode . commands , 'executeCommand' )
7078
7179 // Stub SmusAuthenticationProvider
7280 sinon . stub ( SmusAuthenticationProvider , 'fromContext' ) . returns ( mockSmusAuthProvider as any )
@@ -214,6 +222,9 @@ describe('SMUS Explorer Activation', function () {
214222 await reauthCommand . args [ 1 ] ( mockConnection )
215223
216224 assert . ok ( mockSmusAuthProvider . reauthenticate . calledWith ( mockConnection ) )
225+ assert . ok ( mockSmusRootNode . getProjectSelectNode . called )
226+ assert . ok ( ( mockProjectNode . getProject as sinon . SinonStub ) . called )
227+ assert . ok ( executeCommandSpy . neverCalledWith ( 'aws.smus.switchProject' ) )
217228 assert . ok ( mockTreeDataProvider . refresh . called )
218229
219230 // Check that an information message was shown
0 commit comments