Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Nov 17, 2014
1 parent 0c4867c commit 51ae42c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ var InstalledGamesList = function() {
* @param {string} gamePathOrId path to game or gameId
*/
var remove = function(gamePathOrId, options) {
options = options || {};
try {
getInstalledGames();
if (options.bad) {
Expand Down
4 changes: 4 additions & 0 deletions lib/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ var createMockHTTPServer = function() {

var createHFTServerWithMocks = function(callback) {

var AvailableGames = require('../../server/available-games.js');
var LocalWebSocketServer = require('../../server/localwebsocketserver')
var HFTServer = require('../../server/hft-server');
var RelayServer = require('../../server/relayserver.js');
Expand Down Expand Up @@ -115,15 +116,18 @@ var createHFTServerWithMocks = function(callback) {

var MockedHFTServer = function(callback) {
var httpServer = createMockHTTPServer();
var gameDB = new AvailableGames();
var relayServer = new RelayServer([httpServer], {
WebSocketServer: LocalWebSocketServer,
gameDB: gameDB,
});
var hftServer = hftServer = new HFTServer({
port: 0, // should not be used.
extraPorts: [],
privateServer: true,
httpServer: httpServer,
relayServer: relayServer,
gameDB: gameDB,
}, callback);

this.close = function() {
Expand Down
2 changes: 1 addition & 1 deletion public/hft/0.x.x/scripts/gameclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ define(['./virtualsocket'], function(VirtualSocket) {
if (fn) {
fn.apply(this, args);
} else {
console.error("unknown event: " + eventType);
console.error("GameClient: unknown event: " + eventType);
}
}.bind(this);

Expand Down
2 changes: 1 addition & 1 deletion public/hft/0.x.x/scripts/localnetplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ define(function() {
if (fn) {
fn.call(this, data);
} else {
console.error("Unknown Event: " + eventType);
console.error("LocalNetPlayer: Unknown Event: " + eventType);
}
};

Expand Down
2 changes: 1 addition & 1 deletion public/hft/0.x.x/scripts/netplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ define(function() {
if (fn) {
fn.apply(this, args);
} else {
console.error("Unknown Event: " + eventType);
console.error("NetPlayer: Unknown Event: " + eventType);
}
};

Expand Down
2 changes: 1 addition & 1 deletion server/available-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var AvailableGames = function() {

this.on = emitter.on.bind(emitter);
this.addListener = this.on;
this.removeListender = emitter.removeListener.bind(emitter);
this.removeListener = emitter.removeListener.bind(emitter);
this.reset = gameDB.reset.bind(gameDB);

// When getting games only get what's installed
Expand Down
4 changes: 3 additions & 1 deletion server/hft-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ mime.define({'application/javascript': ["js6"]});
* rendezvous server
* @property {RelayServer?} relayServer relay server to use. (for testing)
* @property {HttpServer?} httpServer http server to use. (for testing)
* @property {GameDB?} gameDB GameDB to use (for testing)
* @property {string?} systemName name to use if mulitiple
* happyFunTimes servers are running on the same
* network.
Expand All @@ -92,13 +93,14 @@ var HFTServer = function(options, startedCallback) {
screenshotCount: 0,
baseDir: "public",
cwd: process.cwd(),
gameDB: new AvailableGames(),
};

Object.keys(options).forEach(function(prop) {
g[prop] = options[prop];
});

g.gameDB = options.gameDB || new AvailableGames();

var eventEmitter = new events.EventEmitter();
var nonRequire = new NonRequire();
var es6Support = new ES6Support({fileSystem: nonRequire.fileSystem});
Expand Down
2 changes: 1 addition & 1 deletion server/hftgame-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ var HFTGameClient = function(options) {
};

var noop = function() { };

client.addEventListener('hftInfo', noop);
client.addEventListener('connect', noop);

this.disconnectGame = function(filter) {
return new Promise(function(resolve, reject) {
Expand Down
1 change: 0 additions & 1 deletion server/relayserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ var WSServer = require('./websocketserver');
* @params {RelayServer~Options} options
*/
var RelayServer = function(servers, options) {

var g_nextSessionId = 0;
var g_gameGroups = {};
var g_numGameGroups = 0;
Expand Down

0 comments on commit 51ae42c

Please sign in to comment.