mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-22 07:12:31 +01:00
Update bower dependencies to more recent versions. Resolved hard-coded dependency by updating file upload PhantomJs to 2.x series for tests (@usta) Fix assertion in tests for compatibility with MongoDB 3.2 (@rhutchison) Improve coding style tests to avoid type errors (@ilanbiala) Fix refresh showing flash of scrollbar in menu Remove deprecated angular-ui-utils Fixes #1124
44 lines
724 B
JavaScript
44 lines
724 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.
|
|
*/
|
|
|
|
var ngInjector = angular.injector(['ng']),
|
|
$window = ngInjector.get('$window');
|
|
|
|
var mock = function () {
|
|
var io = {
|
|
cbs: {},
|
|
connect: connect,
|
|
emit: emit,
|
|
on: on,
|
|
removeListener: removeListener
|
|
};
|
|
|
|
connect();
|
|
|
|
return io;
|
|
|
|
function connect() {
|
|
io.socket = {};
|
|
}
|
|
|
|
function emit(msg, data) {
|
|
io.cbs[msg](data);
|
|
}
|
|
|
|
function on(msg, cb) {
|
|
io.cbs[msg] = cb;
|
|
}
|
|
|
|
function removeListener(msg) {
|
|
delete io.cbs[msg];
|
|
}
|
|
};
|
|
|
|
$window.io = mock;
|
|
})();
|