Skip to content

Commit d00004b

Browse files
author
Zhen Li
committed
Fix the typo in the examples
Added missing end tag and added missing error example
1 parent c5b96c7 commit d00004b

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

test/v1/examples.test.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('examples', function() {
6969
session.close();
7070
driver.close();
7171
});
72-
// tag::minimal-example[]
72+
// end::minimal-example[]
7373
setTimeout(function() {
7474
expect(out[0]).toBe("Neo is 23 years old.");
7575
done();
@@ -153,7 +153,7 @@ describe('examples', function() {
153153
console.log(error);
154154
}
155155
});
156-
// end::result-cursor[]
156+
// end::retain-result-query[]
157157
// Then
158158
done();
159159
});
@@ -210,18 +210,30 @@ describe('examples', function() {
210210
}, 500);
211211
});
212212

213+
it('should be able to handle cypher error', function(done) {
214+
var session = sessionGlobal;
215+
216+
// tag::handle-cypher-error[]
217+
session
218+
.run("Then will cause a syntax error")
219+
.catch( function(err) {
220+
expect(err.fields[0].code).toBe( "Neo.ClientError.Statement.SyntaxError" );
221+
done();
222+
});
223+
// end::handle-cypher-error[]
224+
});
213225

214226
it('should be able to profile', function(done) {
215227
var session = sessionGlobal;
216228

217229
session.run("CREATE (:Person {name:'The One', age: 23})").then(function() {
218-
// tag::retain-result-process[]
230+
// tag::result-summary-query-profile[]
219231
session
220232
.run("PROFILE MATCH (p:Person { name: {name} }) RETURN id(p)", {name: "The One"})
221233
.then(function (result) {
222234
console.log(result.summary.profile);
223235
});
224-
// end::retain-result-process[]
236+
// end::result-summary-query-profile[]
225237
});
226238

227239
//await the result
@@ -234,7 +246,7 @@ describe('examples', function() {
234246
it('should be able to see notifications', function(done) {
235247
var session = sessionGlobal;
236248

237-
// tag::retain-result-process[]
249+
// tag::result-summary-notifications[]
238250
session
239251
.run("EXPLAIN MATCH (a), (b) RETURN a,b")
240252
.then(function (result) {
@@ -243,7 +255,7 @@ describe('examples', function() {
243255
console.log(notifications[i].code);
244256
}
245257
});
246-
// end::retain-result-process[]
258+
// end::result-summary-notifications[]
247259

248260
setTimeout(function () {
249261
expect(out[0]).toBe("Neo.ClientNotification.Statement.CartesianProductWarning");

0 commit comments

Comments
 (0)