Skip to content

Commit 9672614

Browse files
authored
Merge pull request #6 from bigmontz/bolt-agent
Fix browser test in Node10 environment
2 parents 2c97a5d + 0893c00 commit 9672614

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/bolt-connection/src/channel/browser/browser-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ export default class WebSocketChannel {
166166
*/
167167
close () {
168168
return new Promise((resolve, reject) => {
169+
this._clearConnectionTimeout()
169170
if (this._ws && this._ws.readyState !== WS_CLOSED) {
170171
this._open = false
171172
this.stopReceiveTimeout()
172-
this._clearConnectionTimeout()
173173
this._ws.onclose = () => resolve()
174174
this._ws.close()
175175
} else {

packages/neo4j-driver-deno/lib/bolt-connection/channel/browser/browser-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ export default class WebSocketChannel {
166166
*/
167167
close () {
168168
return new Promise((resolve, reject) => {
169+
this._clearConnectionTimeout()
169170
if (this._ws && this._ws.readyState !== WS_CLOSED) {
170171
this._open = false
171172
this.stopReceiveTimeout()
172-
this._clearConnectionTimeout()
173173
this._ws.onclose = () => resolve()
174174
this._ws.close()
175175
} else {

packages/neo4j-driver-lite/test/integration/browser.environment.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ class BrowserEnvironment extends NodeEnvironment {
2323
async setup () {
2424
await super.setup()
2525
this.global.WebSocket = WebSocket
26-
this.global.window = {
27-
navigator: {
28-
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
29-
}
26+
this.global.window = globalThis
27+
this.global.window.navigator = {
28+
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
3029
}
3130
}
3231

0 commit comments

Comments
 (0)