implement BITS + tests
This commit is contained in:
parent
ec859355c6
commit
727bf8524a
14 changed files with 213 additions and 79 deletions
|
|
@ -1,8 +1,7 @@
|
|||
//
|
||||
// test/unit/services/servicesSpec.js
|
||||
//
|
||||
describe("Unit: Testing Services", function() {
|
||||
|
||||
describe("Unit: Socket Service", function() {
|
||||
beforeEach(angular.mock.module('copayApp.services'));
|
||||
|
||||
it('should contain a Socket service', inject(function(Socket) {
|
||||
|
|
@ -17,7 +16,7 @@ describe("Unit: Testing Services", 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) {
|
||||
|
|
@ -40,19 +39,39 @@ describe("Unit: Testing Services", function() {
|
|||
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) {
|
||||
expect(walletFactory).not.to.equal(null);
|
||||
}));
|
||||
|
||||
|
||||
// TODO
|
||||
/*beforeEach(angular.mock.module('copayApp.controllerUtils'));
|
||||
|
||||
it('should contain a controllerUtils service', inject(function(controllerUtils) {
|
||||
expect(controllerUtils).not.to.equal(null);
|
||||
}));
|
||||
*/
|
||||
});
|
||||
|
||||
describe("Unit: controllerUtils", function() {
|
||||
beforeEach(angular.mock.module('copayApp.services'));
|
||||
beforeEach(angular.mock.module('notifications'));
|
||||
|
||||
it('should updateBalance in bits', inject(function(controllerUtils, $rootScope) {
|
||||
expect(controllerUtils.updateBalance).not.to.equal(null);
|
||||
scope = $rootScope.$new();
|
||||
|
||||
$rootScope.wallet=new FakeWallet();
|
||||
var addr = '1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC';
|
||||
var a = {}; a[addr]=100;
|
||||
$rootScope.wallet.set(1000000,900000,a);
|
||||
|
||||
controllerUtils.updateBalance(function() {
|
||||
expect($rootScope.totalBalance).to.be.equal(1000000);
|
||||
expect($rootScope.totalBalanceBTC).to.be.equal('1.000');
|
||||
expect($rootScope.availableBalance).to.be.equal(900000);
|
||||
expect($rootScope.availableBalanceBTC).to.be.equal('0.900');
|
||||
expect($rootScope.addrInfos).not.to.equal(null);
|
||||
expect($rootScope.addrInfos[0].address).to.equal(addr);
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue