2020var neo4j = require ( "../../lib/v1" ) ;
2121
2222describe ( 'driver' , function ( ) {
23-
23+ var driver ;
24+ beforeEach ( function ( ) {
25+ driver = null ;
26+ } )
27+ afterEach ( function ( ) {
28+ if ( driver ) {
29+ driver . close ( ) ;
30+ }
31+ } )
2432 it ( 'should expose sessions' , function ( ) {
2533 // Given
26- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
34+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
2735
2836 // When
2937 var session = driver . session ( ) ;
@@ -35,7 +43,7 @@ describe('driver', function() {
3543
3644 it ( 'should handle connection errors' , function ( done ) {
3745 // Given
38- var driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
46+ driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
3947
4048 // Expect
4149 driver . onError = function ( err ) {
@@ -54,7 +62,7 @@ describe('driver', function() {
5462
5563 it ( 'should fail early on wrong credentials' , function ( done ) {
5664 // Given
57- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "who would use such a password" ) ) ;
65+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "who would use such a password" ) ) ;
5866
5967 // Expect
6068 driver . onError = function ( err ) {
@@ -69,7 +77,7 @@ describe('driver', function() {
6977
7078 it ( 'should indicate success early on correct credentials' , function ( done ) {
7179 // Given
72- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
80+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
7381
7482 // Expect
7583 driver . onCompleted = function ( meta ) {
@@ -82,7 +90,7 @@ describe('driver', function() {
8290
8391 it ( 'should be possible to pass a realm with basic auth tokens' , function ( done ) {
8492 // Given
85- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" , "native" ) ) ;
93+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" , "native" ) ) ;
8694
8795 // Expect
8896 driver . onCompleted = function ( meta ) {
@@ -95,7 +103,7 @@ describe('driver', function() {
95103
96104 it ( 'should be possible to create custom auth tokens' , function ( done ) {
97105 // Given
98- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" ) ) ;
106+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" ) ) ;
99107
100108 // Expect
101109 driver . onCompleted = function ( meta ) {
@@ -108,7 +116,7 @@ describe('driver', function() {
108116
109117 it ( 'should be possible to create custom auth tokens with additional parameters' , function ( done ) {
110118 // Given
111- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" , { secret : 42 } ) ) ;
119+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" , { secret : 42 } ) ) ;
112120
113121 // Expect
114122 driver . onCompleted = function ( ) {
@@ -121,7 +129,7 @@ describe('driver', function() {
121129
122130 it ( 'should fail nicely when connecting with routing to standalone server' , function ( done ) {
123131 // Given
124- var driver = neo4j . driver ( "bolt+routing://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
132+ driver = neo4j . driver ( "bolt+routing://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
125133
126134 // Expect
127135 driver . onError = function ( err ) {
0 commit comments