20
20
var neo4j = require ( "../../lib/v1" ) ;
21
21
22
22
describe ( 'driver' , function ( ) {
23
-
23
+ var driver ;
24
+ beforeEach ( function ( ) {
25
+ driver = null ;
26
+ } )
27
+ afterEach ( function ( ) {
28
+ if ( driver ) {
29
+ driver . close ( ) ;
30
+ }
31
+ } )
24
32
it ( 'should expose sessions' , function ( ) {
25
33
// Given
26
- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
34
+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
27
35
28
36
// When
29
37
var session = driver . session ( ) ;
@@ -35,7 +43,7 @@ describe('driver', function() {
35
43
36
44
it ( 'should handle connection errors' , function ( done ) {
37
45
// Given
38
- var driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
46
+ driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
39
47
40
48
// Expect
41
49
driver . onError = function ( err ) {
@@ -54,7 +62,7 @@ describe('driver', function() {
54
62
55
63
it ( 'should fail early on wrong credentials' , function ( done ) {
56
64
// 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" ) ) ;
58
66
59
67
// Expect
60
68
driver . onError = function ( err ) {
@@ -69,7 +77,7 @@ describe('driver', function() {
69
77
70
78
it ( 'should indicate success early on correct credentials' , function ( done ) {
71
79
// Given
72
- var driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
80
+ driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
73
81
74
82
// Expect
75
83
driver . onCompleted = function ( meta ) {
@@ -82,7 +90,7 @@ describe('driver', function() {
82
90
83
91
it ( 'should be possible to pass a realm with basic auth tokens' , function ( done ) {
84
92
// 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" ) ) ;
86
94
87
95
// Expect
88
96
driver . onCompleted = function ( meta ) {
@@ -95,7 +103,7 @@ describe('driver', function() {
95
103
96
104
it ( 'should be possible to create custom auth tokens' , function ( done ) {
97
105
// 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" ) ) ;
99
107
100
108
// Expect
101
109
driver . onCompleted = function ( meta ) {
@@ -108,7 +116,7 @@ describe('driver', function() {
108
116
109
117
it ( 'should be possible to create custom auth tokens with additional parameters' , function ( done ) {
110
118
// 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 } ) ) ;
112
120
113
121
// Expect
114
122
driver . onCompleted = function ( ) {
@@ -121,7 +129,7 @@ describe('driver', function() {
121
129
122
130
it ( 'should fail nicely when connecting with routing to standalone server' , function ( done ) {
123
131
// 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" ) ) ;
125
133
126
134
// Expect
127
135
driver . onError = function ( err ) {
0 commit comments