@@ -35,7 +35,7 @@ describe('result summary', () => {
35
35
driver . close ( ) ;
36
36
} ) ;
37
37
38
- fit ( 'should get result summary' , done => {
38
+ it ( 'should get result summary' , done => {
39
39
// When & Then
40
40
session . run ( "CREATE (p:Person { Name: 'Test'})" ) . then ( result => {
41
41
var summary = result . summary ;
@@ -65,4 +65,74 @@ describe('result summary', () => {
65
65
done ( ) ;
66
66
} ) ;
67
67
} ) ;
68
+
69
+ it ( 'should get plan from summary' , done => {
70
+ session . run ( "EXPLAIN MATCH (n) RETURN 1" ) . then ( result => {
71
+ var summary = result . summary ;
72
+ expect ( summary . plan ) . toBeDefined ( ) ;
73
+ expect ( summary . profile ) . toBe ( false ) ;
74
+
75
+ var plan = summary . plan ;
76
+ expect ( plan . arguments ) . toBeDefined ( ) ;
77
+ expect ( plan . children ) . toBeDefined ( ) ;
78
+ expect ( plan . identifiers ) . toBeDefined ( ) ;
79
+ expect ( plan . operatorType ) . toBeDefined ( ) ;
80
+ done ( ) ;
81
+ } ) ;
82
+ } ) ;
83
+
84
+ it ( 'should get profile from summary' , done => {
85
+ session . run ( "PROFILE RETURN 1" ) . then ( result => {
86
+ var summary = result . summary ;
87
+ expect ( summary . plan ) . toBeDefined ( ) ;
88
+ expect ( summary . profile ) . toBeDefined ( ) ;
89
+
90
+ var profile = summary . profile ;
91
+ var plan = summary . plan ;
92
+
93
+ verifyPlansAreEqual ( profile , plan ) ;
94
+
95
+ expect ( profile . dbHits ) . toBe ( 0 ) ;
96
+ expect ( profile . rows ) . toBe ( 1 ) ;
97
+
98
+ done ( ) ;
99
+ } ) ;
100
+ } ) ;
101
+
102
+ it ( 'should get notifications from summary' , done => {
103
+ session . run ( "EXPLAIN MATCH (n), (m) RETURN n, m" ) . then ( result => {
104
+ var summary = result . summary ;
105
+ expect ( summary . notifications ) . toBeDefined ( ) ;
106
+ expect ( summary . notifications . length ) . toBe ( 1 ) ;
107
+ var notification = summary . notifications [ 0 ] ;
108
+
109
+ expect ( notification . code ) . toBeDefined ( ) ;
110
+ expect ( notification . title ) . toBeDefined ( ) ;
111
+ expect ( notification . description ) . toBeDefined ( ) ;
112
+ expect ( notification . severity ) . toBeDefined ( ) ;
113
+ expect ( notification . position ) . toBeDefined ( ) ;
114
+
115
+ done ( ) ;
116
+ } ) ;
117
+ } ) ;
118
+
119
+ function verifyPlansAreEqual ( plan1 , plan2 ) {
120
+ expect ( plan1 . arguments ) . toBe ( plan2 . arguments ) ;
121
+ expect ( plan1 . identifiers ) . toBe ( plan2 . identifiers ) ;
122
+ expect ( plan1 . operatorType ) . toBe ( plan2 . operatorType ) ;
123
+
124
+ if ( ! plan1 . children || ! plan2 . children )
125
+ {
126
+ expect ( plan1 . children ) . toBeUndefined ( ) ;
127
+ expect ( plan2 . children ) . toBeUndefined ( ) ;
128
+ }
129
+ else
130
+ {
131
+ expect ( plan1 . children ) . toBeDefined ( ) ;
132
+ expect ( plan2 . children ) . toBeDefined ( ) ;
133
+
134
+ // recursively calling the same method to verify they are equal
135
+ verifyPlansAreEqual ( plan1 . children , plan2 . children ) ;
136
+ }
137
+ }
68
138
} ) ;
0 commit comments