@@ -118,6 +118,23 @@ describe('Bolt V4 API', () => {
118118 done ( )
119119 } )
120120 } )
121+
122+ it ( 'should return db.name as null in result summary' , async ( ) => {
123+ if ( databaseSupportsBoltV4 ( ) ) {
124+ return
125+ }
126+
127+ const session = driver . session ( )
128+
129+ try {
130+ const result = await session . readTransaction ( tx => tx . run ( 'RETURN 1' ) )
131+
132+ expect ( result . summary . database ) . toBeTruthy ( )
133+ expect ( result . summary . database . name ) . toBeNull ( )
134+ } finally {
135+ session . close ( )
136+ }
137+ } )
121138 } )
122139
123140 it ( 'should fail if connecting to a non-existing database' , async ( ) => {
@@ -138,7 +155,17 @@ describe('Bolt V4 API', () => {
138155 }
139156 } )
140157
158+ describe ( 'default database' , function ( ) {
159+ it ( 'should return database name in summary' , async ( ) => {
160+ await testDatabaseNameInSummary ( null )
161+ } )
162+ } )
163+
141164 describe ( 'neo4j database' , ( ) => {
165+ it ( 'should return database name in summary' , async ( ) => {
166+ await testDatabaseNameInSummary ( 'neo4j' )
167+ } )
168+
142169 it ( 'should be able to create a node' , async ( ) => {
143170 if ( ! databaseSupportsBoltV4 ( ) ) {
144171 return
@@ -186,6 +213,27 @@ describe('Bolt V4 API', () => {
186213 } )
187214 } )
188215
216+ async function testDatabaseNameInSummary ( dbname ) {
217+ if ( ! databaseSupportsBoltV4 ( ) ) {
218+ return
219+ }
220+
221+ const neoSession = dbname
222+ ? driver . session ( { db : dbname } )
223+ : driver . session ( )
224+
225+ try {
226+ const result = await neoSession . run ( 'CREATE (n { id: $id }) RETURN n' , {
227+ id : 5
228+ } )
229+
230+ expect ( result . summary . database ) . toBeTruthy ( )
231+ expect ( result . summary . database . name ) . toBe ( dbname || 'neo4j' )
232+ } finally {
233+ neoSession . close ( )
234+ }
235+ }
236+
189237 function expectBoltV4NotSupportedError ( error ) {
190238 expect (
191239 error . message . indexOf (
0 commit comments