mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(electrumx): Fixed connect/disconnect bug that was preventing tests
This commit is contained in:
@@ -81,7 +81,7 @@ class Electrum {
|
||||
|
||||
// Periodically check the connection. If it's not connected, attempt to
|
||||
// reconnect.
|
||||
setInterval(async function () {
|
||||
_this.reconnectIntervalHandle = setInterval(async function () {
|
||||
const status = _this.electrumx.connection.status
|
||||
// console.log(`Electrumx status: ${status}`)
|
||||
|
||||
@@ -111,6 +111,9 @@ class Electrum {
|
||||
// Return immediately if the isReady flag is false.
|
||||
if (!_this.isReady) return true
|
||||
|
||||
// Disable the reconnect timer.
|
||||
clearInterval(_this.reconnectIntervalHandle)
|
||||
|
||||
// Disconnect from the server.
|
||||
await _this.electrumx.disconnect()
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ function expectRouteError (res, result, expectedError, code = 400) {
|
||||
assert.equal(result.success, false)
|
||||
}
|
||||
|
||||
describe('#ElectrumX Router', () => {
|
||||
describe('#Electrumx', () => {
|
||||
let req, res
|
||||
let sandbox
|
||||
const electrumxRoute = new ElecrumxRoute()
|
||||
|
||||
Reference in New Issue
Block a user