Refactor blockchain backing service
This commit is contained in:
parent
b2f4d4d870
commit
33801e9587
12 changed files with 569 additions and 548 deletions
27
test/mocks/FakeBlockchainSocket.js
Normal file
27
test/mocks/FakeBlockchainSocket.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
var FakeSocket = function (url, opts) {
|
||||
var self = this;
|
||||
|
||||
self.connected = false;
|
||||
setTimeout(function() {
|
||||
self.connected = true;
|
||||
self.emit('connect');
|
||||
}, 0);
|
||||
}
|
||||
|
||||
util.inherits(FakeSocket, EventEmitter);
|
||||
|
||||
FakeSocket.prototype.removeEventListener = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
FakeSocket.prototype.destroy = function() {
|
||||
this.connected = false;
|
||||
this.removeAllListeners();
|
||||
};
|
||||
|
||||
module.exports = FakeSocket;
|
||||
Loading…
Add table
Add a link
Reference in a new issue