1717 * limitations under the License.
1818 */
1919
20- var neo4j = require ( " ../../lib /v1" ) ;
20+ import neo4j from ' ../../src /v1' ;
2121
22- describe ( 'driver' , function ( ) {
23- var driver ;
24- beforeEach ( function ( ) {
22+ describe ( 'driver' , ( ) => {
23+
24+ let driver ;
25+
26+ beforeEach ( ( ) => {
2527 driver = null ;
26- } )
27- afterEach ( function ( ) {
28+ } ) ;
29+
30+ afterEach ( ( ) => {
2831 if ( driver ) {
2932 driver . close ( ) ;
3033 }
31- } )
32- it ( 'should expose sessions' , function ( ) {
34+ } ) ;
35+
36+ it ( 'should expose sessions' , ( ) => {
3337 // Given
3438 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
3539
3640 // When
37- var session = driver . session ( ) ;
41+ const session = driver . session ( ) ;
3842
3943 // Then
4044 expect ( session ) . not . toBeNull ( ) ;
4145 driver . close ( ) ;
4246 } ) ;
4347
44- it ( 'should handle connection errors' , function ( done ) {
48+ it ( 'should handle connection errors' , done => {
4549 // Given
4650 driver = neo4j . driver ( "bolt://localhoste" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
4751
4852 // Expect
49- driver . onError = function ( err ) {
53+ driver . onError = err => {
5054 //the error message is different whether in browser or node
5155 expect ( err . message ) . not . toBeNull ( ) ;
5256 done ( ) ;
@@ -72,12 +76,12 @@ describe('driver', function() {
7276 } ) . toBeDefined ( ) ;
7377 } ) ;
7478
75- it ( 'should fail early on wrong credentials' , function ( done ) {
79+ it ( 'should fail early on wrong credentials' , done => {
7680 // Given
7781 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "who would use such a password" ) ) ;
7882
7983 // Expect
80- driver . onError = function ( err ) {
84+ driver . onError = err => {
8185 //the error message is different whether in browser or node
8286 expect ( err . code ) . toEqual ( 'Neo.ClientError.Security.Unauthorized' ) ;
8387 done ( ) ;
@@ -87,51 +91,51 @@ describe('driver', function() {
8791 startNewTransaction ( driver ) ;
8892 } ) ;
8993
90- it ( 'should indicate success early on correct credentials' , function ( done ) {
94+ it ( 'should indicate success early on correct credentials' , done => {
9195 // Given
9296 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" ) ) ;
9397
9498 // Expect
95- driver . onCompleted = function ( meta ) {
99+ driver . onCompleted = meta => {
96100 done ( ) ;
97101 } ;
98102
99103 // When
100104 startNewTransaction ( driver ) ;
101105 } ) ;
102106
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 => {
104108 // Given
105109 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . basic ( "neo4j" , "neo4j" , "native" ) ) ;
106110
107111 // Expect
108- driver . onCompleted = function ( meta ) {
112+ driver . onCompleted = meta => {
109113 done ( ) ;
110114 } ;
111115
112116 // When
113117 startNewTransaction ( driver ) ;
114118 } ) ;
115119
116- it ( 'should be possible to create custom auth tokens' , function ( done ) {
120+ it ( 'should be possible to create custom auth tokens' , done => {
117121 // Given
118122 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" ) ) ;
119123
120124 // Expect
121- driver . onCompleted = function ( meta ) {
125+ driver . onCompleted = meta => {
122126 done ( ) ;
123127 } ;
124128
125129 // When
126130 startNewTransaction ( driver ) ;
127131 } ) ;
128132
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 => {
130134 // Given
131135 driver = neo4j . driver ( "bolt://localhost" , neo4j . auth . custom ( "neo4j" , "neo4j" , "native" , "basic" , { secret : 42 } ) ) ;
132136
133137 // Expect
134- driver . onCompleted = function ( ) {
138+ driver . onCompleted = ( ) => {
135139 done ( ) ;
136140 } ;
137141
@@ -175,7 +179,7 @@ describe('driver', function() {
175179 expect ( createRoutingDriverWithTOFU ) . toThrow ( ) ;
176180 } ) ;
177181
178- var exposedTypes = [
182+ const exposedTypes = [
179183 'Node' ,
180184 'Path' ,
181185 'PathSegment' ,
@@ -187,7 +191,7 @@ describe('driver', function() {
187191 ] ;
188192
189193 exposedTypes . forEach ( type => {
190- it ( `should expose type ${ type } ` , function ( ) {
194+ it ( `should expose type ${ type } ` , ( ) => {
191195 expect ( undefined === neo4j . types [ type ] ) . toBe ( false ) ;
192196 } ) ;
193197 } ) ;
0 commit comments