Skip to content

Commit 8a0fb61

Browse files
authored
Merge pull request #127 from eve-bright/1.0-expose-on-complete
Expose onComplete method from Driver.
2 parents e980878 + acfe28e commit 8a0fb61

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/v1/driver.js

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ class _ConnectionStreamObserver extends StreamObserver {
160160
this._hasFailed = true;
161161
}
162162
}
163+
onCompleted(message) {
164+
if(this._driver.onCompleted) {
165+
this._driver.onCompleted(message);
166+
}
167+
}
163168
}
164169

165170
let USER_AGENT = "neo4j-javascript/" + VERSION;

test/v1/driver.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,17 @@ describe('driver', function() {
6262
// When
6363
driver.session();
6464
});
65+
66+
it('should indicate success early on correct credentials', function(done) {
67+
// Given
68+
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
69+
70+
// Expect
71+
driver.onCompleted = function (meta) {
72+
done();
73+
};
74+
75+
// When
76+
driver.session();
77+
});
6578
});

0 commit comments

Comments
 (0)