mirror of
https://github.com/gundb/panic-server.git
synced 2026-01-12 06:48:11 -05:00
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.
27 lines
569 B
JavaScript
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,
|
|
};
|