Skip to content

Commit cb92637

Browse files
author
Zhen
committed
Changed the position impl
1 parent ef7de18 commit cb92637

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

lib/result-summary.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,21 @@ class Notification {
231231
* @param {Object} notification - Object with notification data
232232
*/
233233
constructor(notification) {
234-
this.code = notifications.code;
235-
this.title = notifications.title;
236-
this.description = notifications.desciption;
237-
this.position[offset, line, column] = notifications.position;
234+
this.code = notification.code;
235+
this.title = notification.title;
236+
this.description = notification.desciption;
237+
this.position = this._constructPosition(notification.position);
238+
}
239+
240+
_constructPosition(pos) {
241+
if(!pos) {
242+
return {};
243+
}
244+
return {
245+
offset: pos.offset.toInt(),
246+
line: pos.line.toInt(),
247+
column: pos.column.toInt()
248+
}
238249
}
239250
}
240251

test/session.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ describe('session', function() {
198198
result.then(function( records ) {
199199
var sum = result.summarize();
200200
expect(sum.notifications.length).toBeGreaterThan(0);
201-
expect(sum.notifications[0].position.offset).toBeGreaterThan(0);
201+
expect(sum.notifications[0].code).toBe("Neo.ClientNotification.Statement.CartesianProduct");
202+
expect(sum.notifications[0].title).toBe("This query builds a cartesian product between disconnected patterns.");
203+
expect(sum.notifications[0].position.column).toBeGreaterThan(0);
202204
driver.close();
203205
done();
204206
});

0 commit comments

Comments
 (0)