@@ -34,6 +34,9 @@ describe('examples', () => {
3434 let testResultPromise ;
3535 let resolveTestResultPromise ;
3636
37+ const user = 'neo4j' ;
38+ const password = 'neo4j' ;
39+
3740 beforeAll ( ( ) => {
3841 originalTimeout = jasmine . DEFAULT_TIMEOUT_INTERVAL ;
3942 jasmine . DEFAULT_TIMEOUT_INTERVAL = 10000 ;
@@ -89,9 +92,6 @@ describe('examples', () => {
8992 } ) ;
9093
9194 it ( 'basic auth example' , done => {
92- const user = 'neo4j' ;
93- const password = 'neo4j' ;
94-
9595 // tag::basic-auth[]
9696 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ) ;
9797 // end::basic-auth[]
@@ -107,9 +107,6 @@ describe('examples', () => {
107107 } ) ;
108108
109109 it ( 'config max retry time example' , done => {
110- const user = 'neo4j' ;
111- const password = 'neo4j' ;
112-
113110 // tag::config-max-retry-time[]
114111 const maxRetryTimeMs = 15 * 1000 ; // 15 seconds
115112 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ,
@@ -130,9 +127,6 @@ describe('examples', () => {
130127 } ) ;
131128
132129 it ( 'config trust example' , done => {
133- const user = 'neo4j' ;
134- const password = 'neo4j' ;
135-
136130 // tag::config-trust[]
137131 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ,
138132 {
@@ -158,9 +152,6 @@ describe('examples', () => {
158152 } ) ;
159153
160154 it ( 'config unencrypted example' , done => {
161- const user = 'neo4j' ;
162- const password = 'neo4j' ;
163-
164155 // tag::config-unencrypted[]
165156 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ,
166157 {
@@ -179,11 +170,11 @@ describe('examples', () => {
179170 } ) ;
180171 } ) ;
181172
182- it ( 'custom auth example' , ( ) => {
183- const principal = 'principal' ;
184- const credentials = 'credentials' ;
185- const realm = 'realm' ;
186- const scheme = 'scheme ' ;
173+ it ( 'custom auth example' , done => {
174+ const principal = user ;
175+ const credentials = password ;
176+ const realm = undefined ;
177+ const scheme = 'basic ' ;
187178 const parameters = { } ;
188179
189180 // tag::custom-auth[]
@@ -193,7 +184,14 @@ describe('examples', () => {
193184 ) ;
194185 // end::custom-auth[]
195186
196- expect ( driver ) . toBeDefined ( ) ;
187+ driver . onCompleted = ( ) => {
188+ done ( ) ;
189+ } ;
190+
191+ const session = driver . session ( ) ;
192+ session . run ( 'RETURN 1' ) . then ( ( ) => {
193+ session . close ( ) ;
194+ } ) ;
197195 } ) ;
198196
199197 it ( 'cypher error example' , done => {
@@ -221,9 +219,6 @@ describe('examples', () => {
221219 } ) ;
222220
223221 it ( 'driver lifecycle example' , done => {
224- const user = 'neo4j' ;
225- const password = 'neo4j' ;
226-
227222 // tag::driver-lifecycle[]
228223 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ) ;
229224
@@ -251,9 +246,6 @@ describe('examples', () => {
251246 } ) ;
252247
253248 it ( 'hello world example' , done => {
254- const user = 'neo4j' ;
255- const password = 'neo4j' ;
256-
257249 // tag::hello-world[]
258250 const driver = neo4j . driver ( 'bolt://localhost:7687' , neo4j . auth . basic ( user , password ) ) ;
259251 const session = driver . session ( ) ;
@@ -395,7 +387,6 @@ describe('examples', () => {
395387 } ) ;
396388
397389 it ( 'service unavailable example' , done => {
398- const user = 'neo4j' ;
399390 const password = 'wrongPassword' ;
400391
401392 // tag::service-unavailable[]
0 commit comments