@@ -77,80 +77,6 @@ describe('Topology (unit)', function () {
77
77
} ) ;
78
78
} ) ;
79
79
80
- describe ( 'shouldCheckForSessionSupport' , function ( ) {
81
- beforeEach ( function ( ) {
82
- this . sinon = sinon . createSandbox ( ) ;
83
-
84
- // these are mocks we want across all tests
85
- this . sinon . stub ( Server . prototype , 'requestCheck' ) ;
86
- this . sinon
87
- . stub ( Topology . prototype , 'selectServer' )
88
- . callsFake ( function ( selector , options , callback ) {
89
- setTimeout ( ( ) => {
90
- const server = Array . from ( this . s . servers . values ( ) ) [ 0 ] ;
91
- callback ( null , server ) ;
92
- } , 50 ) ;
93
- } ) ;
94
- } ) ;
95
-
96
- afterEach ( function ( ) {
97
- this . sinon . restore ( ) ;
98
- } ) ;
99
-
100
- it ( 'should check for sessions if connected to a single server and has no known servers' , function ( done ) {
101
- const topology = new Topology ( 'someserver:27019' ) ;
102
- this . sinon . stub ( Server . prototype , 'connect' ) . callsFake ( function ( ) {
103
- this . s . state = 'connected' ;
104
- this . emit ( 'connect' ) ;
105
- } ) ;
106
-
107
- topology . connect ( ( ) => {
108
- expect ( topology . shouldCheckForSessionSupport ( ) ) . to . be . true ;
109
- topology . close ( done ) ;
110
- } ) ;
111
- } ) ;
112
-
113
- it ( 'should not check for sessions if connected to a single server' , function ( done ) {
114
- const topology = new Topology ( 'someserver:27019' ) ;
115
- this . sinon . stub ( Server . prototype , 'connect' ) . callsFake ( function ( ) {
116
- this . s . state = 'connected' ;
117
- this . emit ( 'connect' ) ;
118
-
119
- setTimeout ( ( ) => {
120
- this . emit (
121
- 'descriptionReceived' ,
122
- new ServerDescription ( 'someserver:27019' , { ok : 1 , maxWireVersion : 6 } )
123
- ) ;
124
- } , 20 ) ;
125
- } ) ;
126
-
127
- topology . connect ( ( ) => {
128
- expect ( topology . shouldCheckForSessionSupport ( ) ) . to . be . false ;
129
- topology . close ( done ) ;
130
- } ) ;
131
- } ) ;
132
-
133
- it ( 'should check for sessions if there are no data-bearing nodes' , function ( done ) {
134
- const topology = new Topology ( [ 'mongos:27019' , 'mongos:27018' , 'mongos:27017' ] , { } ) ;
135
- this . sinon . stub ( Server . prototype , 'connect' ) . callsFake ( function ( ) {
136
- this . s . state = 'connected' ;
137
- this . emit ( 'connect' ) ;
138
-
139
- setTimeout ( ( ) => {
140
- this . emit (
141
- 'descriptionReceived' ,
142
- new ServerDescription ( this . name , { ok : 1 , msg : 'isdbgrid' , maxWireVersion : 6 } )
143
- ) ;
144
- } , 20 ) ;
145
- } ) ;
146
-
147
- topology . connect ( ( ) => {
148
- expect ( topology . shouldCheckForSessionSupport ( ) ) . to . be . false ;
149
- topology . close ( done ) ;
150
- } ) ;
151
- } ) ;
152
- } ) ;
153
-
154
80
describe ( 'black holes' , function ( ) {
155
81
let mockServer ;
156
82
beforeEach ( ( ) => mock . createServer ( ) . then ( server => ( mockServer = server ) ) ) ;
0 commit comments