mirror of https://github.com/BTCPrivate/copay.git
add tests for Socket service
This commit is contained in:
parent
3a4bb56c26
commit
bfa5d4ac51
|
@ -792,7 +792,7 @@ on supported browsers please check <a href="http://www.webrtc.org/">http://www.w
|
|||
<script src="lib/crypto-js/rollups/pbkdf2.js"></script>
|
||||
<script src="lib/crypto-js/rollups/aes.js"></script>
|
||||
<script src="lib/file-saver/FileSaver.js"></script>
|
||||
<script src="lib//socket.io-client/socket.io.js"></script>
|
||||
<script src="lib/socket.io-client/socket.io.js"></script>
|
||||
<script src="lib/sjcl.js"></script>
|
||||
<script src="lib/ios-imagefile-megapixel/megapix-image.js"></script>
|
||||
<script src="lib/qrcode-decoder-js/lib/qrcode-decoder.min.js"></script>
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = function(config) {
|
|||
'lib/crypto-js/rollups/pbkdf2.js',
|
||||
'lib/crypto-js/rollups/aes.js',
|
||||
'lib/file-saver/FileSaver.js',
|
||||
'lib/socket.io.js',
|
||||
'lib/socket.io-client/socket.io.js',
|
||||
'lib/sjcl.js',
|
||||
'lib/ios-imagefile-megapixel/megapix-image.js',
|
||||
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
|
||||
|
|
|
@ -9,6 +9,40 @@ describe("Unit: Testing Services", function() {
|
|||
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 #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);
|
||||
}));
|
||||
|
||||
|
||||
|
||||
it('should contain a walletFactory service', inject(function(walletFactory) {
|
||||
expect(walletFactory).not.to.equal(null);
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue