Update tests

This commit is contained in:
Yemel Jardi 2014-08-29 11:36:23 -03:00
commit 0623c87727
5 changed files with 19 additions and 27 deletions

View file

@ -66,6 +66,7 @@ describe("Unit: controllerUtils", function() {
it(' should call updateAddressList ', inject(function(controllerUtils, $rootScope) {
$rootScope.wallet = new FakeWallet();
var spy = sinon.spy(controllerUtils, 'updateAddressList');
controllerUtils.updateGlobalAddresses();
sinon.assert.callCount(spy, 1);
@ -77,24 +78,6 @@ describe("Unit: controllerUtils", function() {
controllerUtils.updateGlobalAddresses();
expect($rootScope.addrInfos[0].address).to.be.equal(Waddr);;
}));
it('should set System Event Handlers', inject(function(controllerUtils, $rootScope, Socket) {
var spy = sinon.spy(Socket, 'sysOn');
$rootScope.wallet = new FakeWallet();
controllerUtils.updateGlobalAddresses();
sinon.assert.callCount(spy, 5);
['error', 'reconnect_error', 'reconnect_failed', 'connect', 'reconnect'].forEach(function(e) {
sinon.assert.calledWith(spy, e);
});
}));
it('should set Address Event Handlers', inject(function(controllerUtils, $rootScope, Socket) {
var spy = sinon.spy(Socket, 'on');
$rootScope.wallet = new FakeWallet();
var Waddr = Object.keys($rootScope.wallet.balanceByAddr)[0];
controllerUtils.updateGlobalAddresses();
sinon.assert.calledWith(spy, Waddr);
}));
});