@@ -8,7 +8,7 @@ import { ObjectExplorerProvider } from '../src/objectExplorer/objectExplorerProv
8
8
import { ObjectExplorerService } from '../src/objectExplorer/objectExplorerService' ;
9
9
import ConnectionManager from '../src/controllers/connectionManager' ;
10
10
import SqlToolsServiceClient from '../src/languageservice/serviceclient' ;
11
- import { expect } from 'chai' ;
11
+ import { expect , assert } from 'chai' ;
12
12
import { TreeNodeInfo } from '../src/objectExplorer/treeNodeInfo' ;
13
13
import { ConnectionCredentials } from '../src/models/connectionCredentials' ;
14
14
import { Deferred } from '../src/protocol' ;
@@ -17,6 +17,8 @@ import * as LocalizedConstants from '../src/constants/localizedConstants';
17
17
import { AccountSignInTreeNode } from '../src/objectExplorer/accountSignInTreeNode' ;
18
18
import { ConnectTreeNode } from '../src/objectExplorer/connectTreeNode' ;
19
19
import { NodeInfo } from '../src/models/contracts/objectExplorer/nodeInfo' ;
20
+ import { IConnectionCredentials } from '../src/models/interfaces' ;
21
+ import { Type } from '@angular/core' ;
20
22
21
23
suite ( 'Object Explorer Provider Tests' , ( ) => {
22
24
@@ -122,6 +124,63 @@ suite('Object Explorer Provider Tests', () => {
122
124
}
123
125
done ( ) ;
124
126
} ) ;
127
+
128
+ test ( 'Test expandNode function' , ( ) => {
129
+ objectExplorerService . setup ( s => s . expandNode ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAnyString ( ) , TypeMoq . It . isAny ( ) ) ) ;
130
+ let node : any = {
131
+ connectionCredentials : undefined
132
+ } ;
133
+ objectExplorerProvider . expandNode ( node , 'test_session' , undefined ) ;
134
+ objectExplorerService . verify ( s => s . expandNode ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) , TypeMoq . Times . once ( ) ) ;
135
+ let treeItem = objectExplorerProvider . getTreeItem ( node ) ;
136
+ assert . equal ( treeItem , node ) ;
137
+ } ) ;
138
+
139
+ test ( 'Test signInNode function' , ( ) => {
140
+ objectExplorerService . setup ( s => s . signInNodeServer ( TypeMoq . It . isAny ( ) ) ) ;
141
+ let node : any = {
142
+ connectionCredentials : undefined
143
+ } ;
144
+ objectExplorerProvider . signInNodeServer ( node ) ;
145
+ objectExplorerService . verify ( s => s . signInNodeServer ( TypeMoq . It . isAny ( ) ) , TypeMoq . Times . once ( ) ) ;
146
+ } ) ;
147
+
148
+ test ( 'Test updateNode function' , ( ) => {
149
+ objectExplorerService . setup ( s => s . updateNode ( TypeMoq . It . isAny ( ) ) ) ;
150
+ let node : any = {
151
+ connectionCredentials : undefined
152
+ } ;
153
+ objectExplorerProvider . updateNode ( node ) ;
154
+ objectExplorerService . verify ( s => s . updateNode ( node ) , TypeMoq . Times . once ( ) ) ;
155
+ } ) ;
156
+
157
+ test ( 'Test removeConnectionNodes function' , ( ) => {
158
+ objectExplorerService . setup ( s => s . removeConnectionNodes ( TypeMoq . It . isAny ( ) ) ) ;
159
+ let connections : any [ ] = [ { server : 'test_server' } ] ;
160
+ objectExplorerProvider . removeConnectionNodes ( connections ) ;
161
+ objectExplorerService . verify ( s => s . removeConnectionNodes ( connections ) , TypeMoq . Times . once ( ) ) ;
162
+ } ) ;
163
+
164
+ test ( 'Test addDisconnectedNode function' , ( ) => {
165
+ objectExplorerService . setup ( s => s . addDisconnectedNode ( TypeMoq . It . isAny ( ) ) ) ;
166
+ let connectionCredentials : any = { server : 'test_server' } ;
167
+ objectExplorerProvider . addDisconnectedNode ( connectionCredentials ) ;
168
+ objectExplorerService . verify ( s => s . addDisconnectedNode ( TypeMoq . It . isAny ( ) ) , TypeMoq . Times . once ( ) ) ;
169
+ } ) ;
170
+
171
+ test ( 'Test currentNode getter' , ( ) => {
172
+ objectExplorerService . setup ( s => s . currentNode ) ;
173
+ objectExplorerProvider . currentNode ;
174
+ objectExplorerService . verify ( s => s . currentNode , TypeMoq . Times . once ( ) ) ;
175
+ } ) ;
176
+
177
+ test ( 'Test rootNodeConnections getter' , ( ) => {
178
+ let testConnections = [ new ConnectionCredentials ( ) ] ;
179
+ objectExplorerService . setup ( s => s . rootNodeConnections ) . returns ( ( ) => testConnections ) ;
180
+ let rootConnections = objectExplorerProvider . rootNodeConnections ;
181
+ objectExplorerService . verify ( s => s . rootNodeConnections , TypeMoq . Times . once ( ) ) ;
182
+ assert . equal ( rootConnections , testConnections ) ;
183
+ } ) ;
125
184
} ) ;
126
185
127
186
suite ( 'Object Explorer Node Types Test' , ( ) => {
0 commit comments