beginning of large-scale redesign

This commit is contained in:
Alec
2021-11-08 18:26:07 -05:00
parent ee931f1034
commit f861339884
99 changed files with 436 additions and 13683 deletions

View File

@@ -1,65 +0,0 @@
const ServerHelper = require('../../server-helper.js');
const CronJob = require('cron').CronJob;
describe('server helper', function() {
let serverHelper;
beforeEach(function(){
serverHelper = new ServerHelper(CronJob);
});
it('should be instantiated with a cron job', function() {
expect(serverHelper.job).toBeDefined();
expect(serverHelper.job instanceof CronJob).toBeTrue();
});
it('should find a specific game by code in activeGames', function() {
const expectedGame = {"startTime": 12345};
serverHelper.activeGames = {
"somegame": {"startTime": 24156},
"expected": expectedGame,
"filler": {"eh": "i dunno"},
"wrong": {"this is": -Infinity}
};
expect(serverHelper.findGame("expected")).toBe(expectedGame);
});
it('should create a new game', function(){
const spy = jasmine.createSpy("spy");
const game = {"accessCode": "werewolf"};
serverHelper.newGame(game,spy);
expect(serverHelper.findGame("werewolf")).toBeDefined();
expect(serverHelper.findGame("werewolf").accessCode).toEqual("werewolf");
expect(spy).toHaveBeenCalled();
});
xdescribe('should handle players joining', function() {
const socket = {
"emit": (value) => {
return value;
}
};
it('successful adds a player to game', function() {
});
it('rejects a player when the game is full', function() {
});
it('rejects a player when game is not found', function() {
});
});
});