@@ -21,21 +21,71 @@ import neo4j from '../../src/v1'
21
21
import sharedNeo4j from '../internal/shared-neo4j'
22
22
23
23
describe ( 'result summary' , ( ) => {
24
- let driver , session
24
+ describe ( 'default driver' , ( ) => {
25
+ let driver , session
25
26
26
- beforeEach ( done => {
27
- driver = neo4j . driver ( 'bolt://localhost' , sharedNeo4j . authToken )
28
- session = driver . session ( )
27
+ beforeEach ( done => {
28
+ driver = neo4j . driver ( 'bolt://localhost' , sharedNeo4j . authToken )
29
+ session = driver . session ( )
29
30
30
- session . run ( 'MATCH (n) DETACH DELETE n' ) . then ( done )
31
+ session . run ( 'MATCH (n) DETACH DELETE n' ) . then ( done )
32
+ } )
33
+
34
+ afterEach ( ( ) => {
35
+ driver . close ( )
36
+ } )
37
+
38
+ it ( 'should get result summary' , done => {
39
+ verifySummary ( session , done )
40
+ } )
41
+
42
+ it ( 'should get plan from summary' , done => {
43
+ verifyPlan ( session , done )
44
+ } )
45
+
46
+ it ( 'should get profile from summary' , done => {
47
+ verifyProfile ( session , done )
48
+ } )
49
+
50
+ it ( 'should get notifications from summary' , done => {
51
+ verifyNotifications ( session , 'EXPLAIN MATCH (n), (m) RETURN n, m' , done )
52
+ } )
31
53
} )
32
54
33
- afterEach ( ( ) => {
34
- driver . close ( )
55
+ describe ( 'driver with lossless integers disabled' , ( ) => {
56
+ let driver , session
57
+
58
+ beforeEach ( done => {
59
+ driver = neo4j . driver ( 'bolt://localhost' , sharedNeo4j . authToken , {
60
+ disableLosslessIntegers : true
61
+ } )
62
+ session = driver . session ( )
63
+
64
+ session . run ( 'MATCH (n) DETACH DELETE n' ) . then ( done )
65
+ } )
66
+
67
+ afterEach ( ( ) => {
68
+ driver . close ( )
69
+ } )
70
+
71
+ it ( 'should get result summary' , done => {
72
+ verifySummary ( session , done )
73
+ } )
74
+
75
+ it ( 'should get plan from summary' , done => {
76
+ verifyPlan ( session , done )
77
+ } )
78
+
79
+ it ( 'should get profile from summary' , done => {
80
+ verifyProfile ( session , done )
81
+ } )
82
+
83
+ it ( 'should get notifications from summary' , done => {
84
+ verifyNotifications ( session , 'EXPLAIN MATCH (n), (m) RETURN n, m' , done )
85
+ } )
35
86
} )
36
87
37
- it ( 'should get result summary' , done => {
38
- // When & Then
88
+ function verifySummary ( session , done ) {
39
89
session . run ( "CREATE (p:Person { Name: 'Test'})" ) . then ( result => {
40
90
let summary = result . summary
41
91
@@ -63,9 +113,9 @@ describe('result summary', () => {
63
113
expect ( counters . constraintsRemoved ( ) ) . toBe ( 0 )
64
114
done ( )
65
115
} )
66
- } )
116
+ }
67
117
68
- it ( 'should get plan from summary' , done => {
118
+ function verifyPlan ( session , done ) {
69
119
session . run ( 'EXPLAIN MATCH (n) RETURN 1' ) . then ( result => {
70
120
let summary = result . summary
71
121
expect ( summary . plan ) . toBeDefined ( )
@@ -78,9 +128,9 @@ describe('result summary', () => {
78
128
expect ( plan . operatorType ) . toBeDefined ( )
79
129
done ( )
80
130
} )
81
- } )
131
+ }
82
132
83
- it ( 'should get profile from summary' , done => {
133
+ function verifyProfile ( session , done ) {
84
134
session . run ( 'PROFILE RETURN 1' ) . then ( result => {
85
135
let summary = result . summary
86
136
expect ( summary . plan ) . toBeDefined ( )
@@ -96,10 +146,10 @@ describe('result summary', () => {
96
146
97
147
done ( )
98
148
} )
99
- } )
149
+ }
100
150
101
- it ( 'should get notifications from summary' , done => {
102
- session . run ( 'EXPLAIN MATCH (n), (m) RETURN n, m' ) . then ( result => {
151
+ function verifyNotifications ( session , statement , done ) {
152
+ session . run ( statement ) . then ( result => {
103
153
let summary = result . summary
104
154
expect ( summary . notifications ) . toBeDefined ( )
105
155
expect ( summary . notifications . length ) . toBe ( 1 )
@@ -113,7 +163,7 @@ describe('result summary', () => {
113
163
114
164
done ( )
115
165
} )
116
- } )
166
+ }
117
167
118
168
function verifyProfileAndPlanAreEqual ( profile , plan ) {
119
169
expect ( profile . arguments ) . toBe ( plan . arguments )
0 commit comments