Files
panic-server/test/mock.js
Jesse Gibson 37a3838912 Outsource eslint config
Yipes, looks like I still had a bunch of rules stuffed in my
eslintrc file. A while ago I pulled those out into a standalone eslint
config. This commit adds that config, removes all the duplicated rules,
and fixes the errors ensuing from revised formatting preferences.
2016-11-25 16:05:59 -07:00

27 lines
569 B
JavaScript

'use strict';
var Emitter = require('events');
var Client = require('../src/Client');
/**
* Creates a client wrapping a new fake websocket.
* @param {Object} [platform] - A platform.js-style object.
* @return {Client} - Draws from a fake socket instance.
*/
function mock (platform) {
var rand = Math.random();
// Fake a socket.io socket.
var socket = new Emitter();
socket.connected = true;
socket.id = rand.toString(36).slice(2);
return new Client({
socket: socket,
platform: platform || {},
});
}
module.exports = {
Client: mock,
};