11/**
22 * Created by klond on 05.04.15.
33 */
4+
5+ /*eslint-env mocha */
6+ /* global Promise */
7+
48var fs = require ( 'fs' ) ;
59var assert = require ( 'assert' ) ;
610var TarantoolConnection = require ( '../lib/connection' ) ;
@@ -18,27 +22,29 @@ describe('Tarantool Connection tests', function(){
1822 it ( 'connect' , function ( done ) {
1923 conn . connect ( ) . then ( function ( ) {
2024 done ( ) ;
21- } , function ( e ) { throw 'not connected' ; done ( ) ; } ) ;
25+ } , function ( e ) { throw 'not connected' ; } ) ;
2226 } ) ;
2327 it ( 'auth' , function ( done ) {
2428 conn . connect ( ) . then ( function ( ) {
2529 return conn . auth ( 'test' , 'test' ) ;
26- } , function ( e ) { throw 'not connected' ; done ( ) ; } )
30+ } , function ( e ) { throw 'not connected' ; } )
2731 . then ( function ( ) {
2832 done ( ) ;
29- } , function ( e ) { throw 'not auth' ; done ( ) ; } )
33+ } , function ( e ) { throw 'not auth' ; } ) ;
3034 } ) ;
3135 } ) ;
3236 describe ( 'requests' , function ( ) {
3337 var insertTuple = [ 50 , 10 , 'my key' , 30 ] ;
38+ /*eslint-disable no-shadow */
3439 var conn ;
40+ /*eslint-enable no-shadow */
3541 before ( function ( done ) {
3642 console . log ( 'before call' ) ;
3743 try {
3844 conn = new TarantoolConnection ( { port : 33013 } ) ;
3945 conn . connect ( ) . then ( function ( ) {
4046 return conn . auth ( 'test' , 'test' ) ;
41- } , function ( e ) { throw 'not connected' ; done ( ) ; } )
47+ } , function ( e ) { throw 'not connected' ; } )
4248 . then ( function ( ) {
4349 return Promise . all ( [ conn . delete ( 514 , 0 , [ 1 ] ) , conn . delete ( 514 , 0 , [ 2 ] ) ,
4450 conn . delete ( 514 , 0 , [ 3 ] ) , conn . delete ( 514 , 0 , [ 4 ] ) ,
@@ -118,7 +124,7 @@ describe('Tarantool Connection tests', function(){
118124 assert . equal ( a . length , 1 ) ;
119125 assert . equal ( a [ 0 ] [ 3 ] , insertTuple [ 3 ] + 10 ) ;
120126 done ( ) ;
121- } ) . catch ( function ( e ) { done ( e ) } ) ;
127+ } ) . catch ( function ( e ) { done ( e ) ; } ) ;
122128 } ) ;
123129 it ( 'a lot of insert' , function ( done ) {
124130 var promises = [ ] ;
@@ -145,35 +151,35 @@ describe('Tarantool Connection tests', function(){
145151 it ( 'call print' , function ( done ) {
146152 conn . call ( 'myprint' , [ 'test' ] )
147153 . then ( function ( ) {
148- done ( )
154+ done ( ) ;
149155 } )
150156 . catch ( function ( e ) {
151157 console . log ( e ) ;
152158 done ( e ) ;
153- } )
159+ } ) ;
154160 } ) ;
155161 it ( 'call batch' , function ( done ) {
156162 conn . call ( 'batch' , [ [ 1 ] , [ 2 ] , [ 3 ] ] )
157163 . then ( function ( ) {
158- done ( )
164+ done ( ) ;
159165 } )
160166 . catch ( function ( e ) {
161167 console . log ( e ) ;
162168 done ( e ) ;
163- } )
169+ } ) ;
164170 } ) ;
165171 it ( 'call get' , function ( done ) {
166172 conn . insert ( 514 , [ 4 ] )
167173 . then ( function ( ) {
168- return conn . call ( 'myget' , 4 )
174+ return conn . call ( 'myget' , 4 ) ;
169175 } )
170176 . then ( function ( value ) {
171- done ( )
177+ done ( ) ;
172178 } )
173179 . catch ( function ( e ) {
174180 console . log ( e ) ;
175181 done ( e ) ;
176- } )
182+ } ) ;
177183 } ) ;
178184 it ( 'get metadata space by name' , function ( done ) {
179185 conn . _getSpaceId ( 'batched' )
@@ -183,7 +189,7 @@ describe('Tarantool Connection tests', function(){
183189 } )
184190 . catch ( function ( e ) {
185191 done ( e ) ;
186- } )
192+ } ) ;
187193 } ) ;
188194 it ( 'get metadata index by name' , function ( done ) {
189195 conn . _getIndexId ( 514 , 'primary' )
@@ -193,7 +199,7 @@ describe('Tarantool Connection tests', function(){
193199 } )
194200 . catch ( function ( e ) {
195201 done ( e ) ;
196- } )
202+ } ) ;
197203 } ) ;
198204 it ( 'insert with space name' , function ( done ) {
199205 conn . insert ( 'test' , [ 999 , 999 , 'fear' ] )
@@ -239,13 +245,15 @@ describe('Tarantool Connection tests', function(){
239245 } ) ;
240246 } ) ;
241247 describe ( 'upsert' , function ( ) {
248+ /*eslint-disable no-shadow */
242249 var conn ;
250+ /*eslint-enable no-shadow */
243251 before ( function ( done ) {
244252 try {
245253 conn = new TarantoolConnection ( { port : 33013 } ) ;
246254 conn . connect ( ) . then ( function ( ) {
247255 return conn . auth ( 'test' , 'test' ) ;
248- } , function ( e ) { throw 'not connected' ; done ( ) ; } )
256+ } , function ( e ) { throw 'not connected' ; } )
249257 . then ( function ( ) {
250258 return Promise . all ( [
251259 conn . delete ( 'upstest' , 'primary' , 1 ) ,
@@ -276,7 +284,7 @@ describe('Tarantool Connection tests', function(){
276284
277285 . catch ( function ( e ) {
278286 done ( e ) ;
279- } )
287+ } ) ;
280288 } ) ;
281289 it ( 'update' , function ( done ) {
282290 conn . upsert ( 'upstest' , 2 , [ [ '+' , 2 , 2 ] ] , [ 2 , 4 , 3 ] )
@@ -294,7 +302,7 @@ describe('Tarantool Connection tests', function(){
294302
295303 . catch ( function ( e ) {
296304 done ( e ) ;
297- } )
305+ } ) ;
298306 } ) ;
299307 } ) ;
300308 describe ( 'connection test with custom msgpack implementation' , function ( ) {
@@ -317,15 +325,15 @@ describe('Tarantool Connection tests', function(){
317325 it ( 'connect' , function ( done ) {
318326 customConn . connect ( ) . then ( function ( ) {
319327 done ( ) ;
320- } , function ( e ) { throw 'not connected' ; done ( ) ; } ) ;
328+ } , function ( e ) { throw 'not connected' ; } ) ;
321329 } ) ;
322330 it ( 'auth' , function ( done ) {
323331 customConn . connect ( ) . then ( function ( ) {
324332 return customConn . auth ( 'test' , 'test' ) ;
325- } , function ( e ) { throw 'not connected' ; done ( ) ; } )
333+ } , function ( e ) { throw 'not connected' ; } )
326334 . then ( function ( ) {
327335 done ( ) ;
328- } , function ( e ) { throw 'not auth' ; done ( ) ; } )
336+ } , function ( e ) { throw 'not auth' ; } ) ;
329337 } ) ;
330338 } ) ;
331339} ) ;
0 commit comments