Wallet/test/unit/services/servicesSpec.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2014-04-23 13:21:33 -03:00
//
// test/unit/services/servicesSpec.js
//
describe("Unit: Testing Services", function() {
2014-06-03 17:42:36 -03:00
beforeEach(angular.mock.module('copayApp.services'));
2014-04-23 18:07:20 -03:00
it('should contain a Socket service', inject(function(Socket) {
expect(Socket).not.to.equal(null);
}));
2014-06-04 20:17:45 -03:00
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 #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);
}));
2014-04-23 18:07:20 -03:00
it('should contain a walletFactory service', inject(function(walletFactory) {
expect(walletFactory).not.to.equal(null);
}));
2014-06-03 10:10:03 -03:00
// TODO
2014-06-03 17:42:36 -03:00
/*beforeEach(angular.mock.module('copayApp.controllerUtils'));
2014-04-23 18:07:20 -03:00
it('should contain a controllerUtils service', inject(function(controllerUtils) {
expect(controllerUtils).not.to.equal(null);
}));
2014-06-03 10:10:03 -03:00
*/
2014-04-23 13:21:33 -03:00
});