Refactor blockchain backing service

This commit is contained in:
Yemel Jardi 2014-08-28 14:23:49 -03:00
commit 33801e9587
12 changed files with 569 additions and 548 deletions

View file

@ -18,56 +18,6 @@ describe('Check config', function() {
});
});
describe("Unit: Socket Service", function() {
beforeEach(angular.mock.module('copayApp.services'));
it('should contain a Socket service', inject(function(Socket) {
expect(Socket).not.to.equal(null);
}));
it('Socket should support #on', inject(function(Socket) {
expect(Socket.on).to.be.a('function');
}));
it('Socket should support #sysOn', inject(function(Socket) {
expect(Socket.sysOn).to.be.a('function');
}));
it('Socket should add handlers with #on', inject(function(Socket) {
Socket.on('a', function() {});
Socket.on('b', function() {});
Socket.sysOn('c', function() {});
var ret = Socket.getListeners();
expect(ret.a).to.be.equal(1);
expect(ret.b).to.be.equal(1);
expect(Object.keys(ret)).to.have.length(2);
}));
it('Socket should support block event', inject(function(Socket) {
expect(Socket.isListeningBlocks()).to.be.false;
Socket.on('block', function() {});
expect(Socket.isListeningBlocks()).to.be.true;
Socket.removeAllListeners();
expect(Socket.isListeningBlocks()).to.be.false;
}));
it('Socket should support #removeAllListeners', inject(function(Socket) {
Socket.on('a', function() {});
Socket.on('b', function() {});
Socket.sysOn('c', function() {});
var ret = Socket.getListeners();
expect(Object.keys(ret)).to.have.length(2);
Socket.removeAllListeners();
ret = Socket.getListeners();
expect(Object.keys(ret)).to.have.length(0);
}));
});
describe("Unit: Walletfactory Service", function() {
beforeEach(angular.mock.module('copayApp.services'));
it('should contain a walletFactory service', inject(function(walletFactory) {