Files
meanTorrent/modules/core/tests/client/socket.io.client.service.tests.js
2015-07-29 06:51:38 -06:00

25 lines
524 B
JavaScript

(function() {
'use strict';
/* Creates a mock of socket.io for the browser.
* Functionality of the service is tested through
* the chat controller tests.
*/
window.io = function() {
this.cbs = {};
this.on = function(msg, cb) {
this.cbs[msg] = cb;
};
this.emit = function(msg, data) {
this.cbs[msg](data);
};
this.removeListener = function(msg) {
delete this.cbs[msg];
};
this.connect = function() {
this.socket = {};
};
return this;
};
})();