17
17
* limitations under the License.
18
18
*/
19
19
20
- var neo4j = require ( " ../../lib /v1" ) ;
20
+ import neo4j from ' ../../src /v1' ;
21
21
22
- describe ( 'driver' , function ( ) {
23
- var driver ;
24
- beforeEach ( function ( ) {
22
+ describe ( 'driver' , ( ) => {
23
+
24
+ let driver ;
25
+
26
+ beforeEach ( ( ) => {
25
27
driver = null ;
26
- } )
27
- afterEach ( function ( ) {
28
+ } ) ;
29
+
30
+ afterEach ( ( ) => {
28
31
if ( driver ) {
29
32
driver . close ( ) ;
30
33
}
31
- } )
32
- it ( 'should expose sessions' , function ( ) {
34
+ } ) ;
35
+
36
+ it ( 'should expose sessions' , ( ) => {
33
37
// Given
34
38
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
35
39
36
40
// When
37
- var session = driver . session ( ) ;
41
+ const session = driver . session ( ) ;
38
42
39
43
// Then
40
44
expect ( session ) . not . toBeNull ( ) ;
41
45
driver . close ( ) ;
42
46
} ) ;
43
47
44
- it ( 'should handle connection errors' , function ( done ) {
48
+ it ( 'should handle connection errors' , done => {
45
49
// Given
46
50
driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
47
51
48
52
// Expect
49
- driver . onError = function ( err ) {
53
+ driver . onError = err => {
50
54
//the error message is different whether in browser or node
51
55
expect ( err . message ) . not . toBeNull ( ) ;
52
56
done ( ) ;
@@ -72,12 +76,12 @@ describe('driver', function() {
72
76
} ) . toBeDefined ( ) ;
73
77
} ) ;
74
78
75
- it ( 'should fail early on wrong credentials' , function ( done ) {
79
+ it ( 'should fail early on wrong credentials' , done => {
76
80
// Given
77
81
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "who would use such a password" ) ) ;
78
82
79
83
// Expect
80
- driver . onError = function ( err ) {
84
+ driver . onError = err => {
81
85
//the error message is different whether in browser or node
82
86
expect ( err . code ) . toEqual ( 'Neo.ClientError.Security.Unauthorized' ) ;
83
87
done ( ) ;
@@ -87,51 +91,51 @@ describe('driver', function() {
87
91
startNewTransaction ( driver ) ;
88
92
} ) ;
89
93
90
- it ( 'should indicate success early on correct credentials' , function ( done ) {
94
+ it ( 'should indicate success early on correct credentials' , done => {
91
95
// Given
92
96
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
93
97
94
98
// Expect
95
- driver . onCompleted = function ( meta ) {
99
+ driver . onCompleted = meta => {
96
100
done ( ) ;
97
101
} ;
98
102
99
103
// When
100
104
startNewTransaction ( driver ) ;
101
105
} ) ;
102
106
103
- it ( 'should be possible to pass a realm with basic auth tokens' , function ( done ) {
107
+ it ( 'should be possible to pass a realm with basic auth tokens' , done => {
104
108
// Given
105
109
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" , "native" ) ) ;
106
110
107
111
// Expect
108
- driver . onCompleted = function ( meta ) {
112
+ driver . onCompleted = meta => {
109
113
done ( ) ;
110
114
} ;
111
115
112
116
// When
113
117
startNewTransaction ( driver ) ;
114
118
} ) ;
115
119
116
- it ( 'should be possible to create custom auth tokens' , function ( done ) {
120
+ it ( 'should be possible to create custom auth tokens' , done => {
117
121
// Given
118
122
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" ) ) ;
119
123
120
124
// Expect
121
- driver . onCompleted = function ( meta ) {
125
+ driver . onCompleted = meta => {
122
126
done ( ) ;
123
127
} ;
124
128
125
129
// When
126
130
startNewTransaction ( driver ) ;
127
131
} ) ;
128
132
129
- it ( 'should be possible to create custom auth tokens with additional parameters' , function ( done ) {
133
+ it ( 'should be possible to create custom auth tokens with additional parameters' , done => {
130
134
// Given
131
135
driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" , { secret : 42 } ) ) ;
132
136
133
137
// Expect
134
- driver . onCompleted = function ( ) {
138
+ driver . onCompleted = ( ) => {
135
139
done ( ) ;
136
140
} ;
137
141
@@ -175,7 +179,7 @@ describe('driver', function() {
175
179
expect ( createRoutingDriverWithTOFU ) . toThrow ( ) ;
176
180
} ) ;
177
181
178
- var exposedTypes = [
182
+ const exposedTypes = [
179
183
'Node' ,
180
184
'Path' ,
181
185
'PathSegment' ,
@@ -187,7 +191,7 @@ describe('driver', function() {
187
191
] ;
188
192
189
193
exposedTypes . forEach ( type => {
190
- it ( `should expose type ${ type } ` , function ( ) {
194
+ it ( `should expose type ${ type } ` , ( ) => {
191
195
expect ( undefined === neo4j . types [ type ] ) . toBe ( false ) ;
192
196
} ) ;
193
197
} ) ;
0 commit comments