mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
lint
This commit is contained in:
@@ -34,7 +34,7 @@ describe('game page', () => {
|
||||
args[args.length - 1](deepCopy(mockGames.gameInLobby)); // copy the game object to prevent leaking of state between specs
|
||||
}
|
||||
},
|
||||
removeAllListeners: function(...names) {
|
||||
removeAllListeners: function (...names) {
|
||||
|
||||
},
|
||||
hasListeners: function (listener) {
|
||||
@@ -105,12 +105,12 @@ describe('game page', () => {
|
||||
hasListeners: function (listener) {
|
||||
return false;
|
||||
},
|
||||
removeAllListeners: function(...names) {
|
||||
removeAllListeners: function (...names) {
|
||||
|
||||
},
|
||||
once: function (message, handler) {
|
||||
this.eventHandlers[message] = handler;
|
||||
},
|
||||
}
|
||||
};
|
||||
await gameHandler(mockSocket, XHRUtility, { location: { href: 'host/game/ABCD' } }, gameTemplate);
|
||||
mockSocket.eventHandlers.connect();
|
||||
@@ -185,9 +185,9 @@ describe('game page', () => {
|
||||
hasListeners: function (listener) {
|
||||
return false;
|
||||
},
|
||||
removeAllListeners: function(...names) {
|
||||
removeAllListeners: function (...names) {
|
||||
|
||||
},
|
||||
}
|
||||
};
|
||||
await gameHandler(mockSocket, XHRUtility, { location: { href: 'host/game/ABCD' } }, gameTemplate);
|
||||
mockSocket.eventHandlers.connect();
|
||||
|
||||
@@ -1,311 +1,311 @@
|
||||
export const mockGames = {
|
||||
gameInLobby: {
|
||||
"accessCode": "TVV6",
|
||||
"status": "lobby",
|
||||
"currentModeratorId": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"client": {
|
||||
"name": "Alec",
|
||||
"hasEnteredName": false,
|
||||
"id": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"cookie": "28p80dbhY2k1iP1NuEy8UPFmuOctLx3nR0EMONU4MlJFfVrCzNncdNdsav9wEuGEswLQ70DKqa3",
|
||||
"userType": "moderator"
|
||||
accessCode: 'TVV6',
|
||||
status: 'lobby',
|
||||
currentModeratorId: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
client: {
|
||||
name: 'Alec',
|
||||
hasEnteredName: false,
|
||||
id: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
cookie: '28p80dbhY2k1iP1NuEy8UPFmuOctLx3nR0EMONU4MlJFfVrCzNncdNdsav9wEuGEswLQ70DKqa3',
|
||||
userType: 'moderator'
|
||||
},
|
||||
"deck": [
|
||||
deck: [
|
||||
{
|
||||
"role": "Villager",
|
||||
"team": "good",
|
||||
"description": "During the day, find the wolves and kill them.",
|
||||
"id": "52u5w81ryq5h30qu1gri56xxq",
|
||||
"quantity": 6
|
||||
role: 'Villager',
|
||||
team: 'good',
|
||||
description: 'During the day, find the wolves and kill them.',
|
||||
id: '52u5w81ryq5h30qu1gri56xxq',
|
||||
quantity: 6
|
||||
},
|
||||
{
|
||||
"role": "Werewolf",
|
||||
"team": "evil",
|
||||
"description": "During the night, choose a villager to kill. Don't get killed.",
|
||||
"id": "9uk0jcrm1hkhygzb6iw8xh2a7",
|
||||
"quantity": 1
|
||||
role: 'Werewolf',
|
||||
team: 'evil',
|
||||
description: "During the night, choose a villager to kill. Don't get killed.",
|
||||
id: '9uk0jcrm1hkhygzb6iw8xh2a7',
|
||||
quantity: 1
|
||||
}
|
||||
],
|
||||
"gameSize": 7,
|
||||
"people": [
|
||||
gameSize: 7,
|
||||
people: [
|
||||
{
|
||||
"name": "Alec",
|
||||
"id": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"userType": "moderator",
|
||||
"gameRole": null,
|
||||
"gameRoleDescription": null,
|
||||
"alignment": null,
|
||||
"out": true,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Alec',
|
||||
id: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
userType: 'moderator',
|
||||
gameRole: null,
|
||||
gameRoleDescription: null,
|
||||
alignment: null,
|
||||
out: true,
|
||||
killed: false,
|
||||
revealed: false
|
||||
}
|
||||
],
|
||||
"timerParams": {
|
||||
"hours": null,
|
||||
"minutes": 10,
|
||||
"paused": true,
|
||||
"timeRemaining": 600000
|
||||
timerParams: {
|
||||
hours: null,
|
||||
minutes: 10,
|
||||
paused: true,
|
||||
timeRemaining: 600000
|
||||
},
|
||||
"isFull": false
|
||||
isFull: false
|
||||
},
|
||||
inProgressGame: {
|
||||
"accessCode": "TVV6",
|
||||
"status": "in progress",
|
||||
"currentModeratorId": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"client": {
|
||||
"name": "Andrea",
|
||||
"hasEnteredName": false,
|
||||
"id": "pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW",
|
||||
"cookie": "iIXXtc4BMtMSKOiDnz7sp20AE5QEIEzw7Ro2djXkZax4PQo3jR3VQGEAaD3WvaEBt06ZWgqi8s9",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false
|
||||
accessCode: 'TVV6',
|
||||
status: 'in progress',
|
||||
currentModeratorId: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
client: {
|
||||
name: 'Andrea',
|
||||
hasEnteredName: false,
|
||||
id: 'pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW',
|
||||
cookie: 'iIXXtc4BMtMSKOiDnz7sp20AE5QEIEzw7Ro2djXkZax4PQo3jR3VQGEAaD3WvaEBt06ZWgqi8s9',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false
|
||||
},
|
||||
"deck": [
|
||||
deck: [
|
||||
{
|
||||
"role": "Villager",
|
||||
"team": "good",
|
||||
"description": "During the day, find the wolves and kill them.",
|
||||
"id": "52u5w81ryq5h30qu1gri56xxq",
|
||||
"quantity": 6
|
||||
role: 'Villager',
|
||||
team: 'good',
|
||||
description: 'During the day, find the wolves and kill them.',
|
||||
id: '52u5w81ryq5h30qu1gri56xxq',
|
||||
quantity: 6
|
||||
},
|
||||
{
|
||||
"role": "Werewolf",
|
||||
"team": "evil",
|
||||
"description": "During the night, choose a villager to kill. Don't get killed.",
|
||||
"id": "9uk0jcrm1hkhygzb6iw8xh2a7",
|
||||
"quantity": 1
|
||||
role: 'Werewolf',
|
||||
team: 'evil',
|
||||
description: "During the night, choose a villager to kill. Don't get killed.",
|
||||
id: '9uk0jcrm1hkhygzb6iw8xh2a7',
|
||||
quantity: 1
|
||||
}
|
||||
],
|
||||
"gameSize": 7,
|
||||
"people": [
|
||||
gameSize: 7,
|
||||
people: [
|
||||
{
|
||||
"name": "Andrea",
|
||||
"id": "pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Andrea',
|
||||
id: 'pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Hannah",
|
||||
"id": "ojCjJqIXfNkOunHD9v2gQSNXRUQPzZCJzzuPTKyQy5TiyZ83ziHMvr2ZzDLWMb4M6dXqa8rN3O3",
|
||||
"userType": "killed",
|
||||
"out": true,
|
||||
"killed": true,
|
||||
"revealed": true,
|
||||
"gameRole": "Villager",
|
||||
"alignment": "good"
|
||||
name: 'Hannah',
|
||||
id: 'ojCjJqIXfNkOunHD9v2gQSNXRUQPzZCJzzuPTKyQy5TiyZ83ziHMvr2ZzDLWMb4M6dXqa8rN3O3',
|
||||
userType: 'killed',
|
||||
out: true,
|
||||
killed: true,
|
||||
revealed: true,
|
||||
gameRole: 'Villager',
|
||||
alignment: 'good'
|
||||
},
|
||||
{
|
||||
"name": "Greg",
|
||||
"id": "1o2IntIivHV4pMqV2iMBi3lrMloHcShQiXObuedyc1DqeUho5aD0DI6Vqhja97c1GIMNzfyNC4a",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Greg',
|
||||
id: '1o2IntIivHV4pMqV2iMBi3lrMloHcShQiXObuedyc1DqeUho5aD0DI6Vqhja97c1GIMNzfyNC4a',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Jerret",
|
||||
"id": "eaxAqb1nj25jqWHnsWirSdYjLhHQVkQtnIkC4eHvmuleN7FtaG8XYnLJnBv4hhFvXWNbUguTrLJ",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Jerret',
|
||||
id: 'eaxAqb1nj25jqWHnsWirSdYjLhHQVkQtnIkC4eHvmuleN7FtaG8XYnLJnBv4hhFvXWNbUguTrLJ',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Lys",
|
||||
"id": "v2eOvaYKusGfiUpuZWTCJ0JUiESC29OuH6fpivwMuwcqizpYTCAzetrPl7fF8F5CoR35pTMIKxh",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Lys',
|
||||
id: 'v2eOvaYKusGfiUpuZWTCJ0JUiESC29OuH6fpivwMuwcqizpYTCAzetrPl7fF8F5CoR35pTMIKxh',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Matt",
|
||||
"id": "pUDrpiGF1vuMfhztT2KY9bllBoGILVl2vIpRWVFH27SnqGiVP3LunjO0wy0otXToWzwbXBlx7ga",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Matt',
|
||||
id: 'pUDrpiGF1vuMfhztT2KY9bllBoGILVl2vIpRWVFH27SnqGiVP3LunjO0wy0otXToWzwbXBlx7ga',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Steve",
|
||||
"id": "Csz1haKdNa3WLIbqllRwV2e9TgwMlDoQwzbpZkTa0JhioUT5MD1GopUHU90f6cyfQ2Uv7YBTZo1",
|
||||
"userType": "player",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Steve',
|
||||
id: 'Csz1haKdNa3WLIbqllRwV2e9TgwMlDoQwzbpZkTa0JhioUT5MD1GopUHU90f6cyfQ2Uv7YBTZo1',
|
||||
userType: 'player',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Alec",
|
||||
"id": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"userType": "moderator",
|
||||
"out": true,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Alec',
|
||||
id: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
userType: 'moderator',
|
||||
out: true,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Stav",
|
||||
"id": "BKfs1N0cfvwc309eOdwrTeum8NScSX7S8CTCGXgiI6JZufjAgD4WAdkkryn3sqIqKeswCFpIuTc",
|
||||
"userType": "spectator",
|
||||
"out": true,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Stav',
|
||||
id: 'BKfs1N0cfvwc309eOdwrTeum8NScSX7S8CTCGXgiI6JZufjAgD4WAdkkryn3sqIqKeswCFpIuTc',
|
||||
userType: 'spectator',
|
||||
out: true,
|
||||
killed: false,
|
||||
revealed: false
|
||||
}
|
||||
],
|
||||
"timerParams": {
|
||||
"hours": null,
|
||||
"minutes": 10,
|
||||
"paused": true,
|
||||
"timeRemaining": 600000
|
||||
timerParams: {
|
||||
hours: null,
|
||||
minutes: 10,
|
||||
paused: true,
|
||||
timeRemaining: 600000
|
||||
},
|
||||
"isFull": true
|
||||
isFull: true
|
||||
},
|
||||
moderatorGame:
|
||||
{
|
||||
"accessCode": "TVV6",
|
||||
"status": "in progress",
|
||||
"currentModeratorId": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"client": {
|
||||
"name": "Alec",
|
||||
"hasEnteredName": false,
|
||||
"id": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"cookie": "28p80dbhY2k1iP1NuEy8UPFmuOctLx3nR0EMONU4MlJFfVrCzNncdNdsav9wEuGEswLQ70DKqa3",
|
||||
"userType": "moderator",
|
||||
"gameRole": null,
|
||||
"gameRoleDescription": null,
|
||||
"alignment": null,
|
||||
"out": true,
|
||||
"killed": false
|
||||
accessCode: 'TVV6',
|
||||
status: 'in progress',
|
||||
currentModeratorId: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
client: {
|
||||
name: 'Alec',
|
||||
hasEnteredName: false,
|
||||
id: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
cookie: '28p80dbhY2k1iP1NuEy8UPFmuOctLx3nR0EMONU4MlJFfVrCzNncdNdsav9wEuGEswLQ70DKqa3',
|
||||
userType: 'moderator',
|
||||
gameRole: null,
|
||||
gameRoleDescription: null,
|
||||
alignment: null,
|
||||
out: true,
|
||||
killed: false
|
||||
},
|
||||
"deck": [
|
||||
deck: [
|
||||
{
|
||||
"role": "Villager",
|
||||
"team": "good",
|
||||
"description": "During the day, find the wolves and kill them.",
|
||||
"id": "52u5w81ryq5h30qu1gri56xxq",
|
||||
"quantity": 6
|
||||
role: 'Villager',
|
||||
team: 'good',
|
||||
description: 'During the day, find the wolves and kill them.',
|
||||
id: '52u5w81ryq5h30qu1gri56xxq',
|
||||
quantity: 6
|
||||
},
|
||||
{
|
||||
"role": "Werewolf",
|
||||
"team": "evil",
|
||||
"description": "During the night, choose a villager to kill. Don't get killed.",
|
||||
"id": "9uk0jcrm1hkhygzb6iw8xh2a7",
|
||||
"quantity": 1
|
||||
role: 'Werewolf',
|
||||
team: 'evil',
|
||||
description: "During the night, choose a villager to kill. Don't get killed.",
|
||||
id: '9uk0jcrm1hkhygzb6iw8xh2a7',
|
||||
quantity: 1
|
||||
}
|
||||
],
|
||||
"gameSize": 7,
|
||||
"people": [
|
||||
gameSize: 7,
|
||||
people: [
|
||||
{
|
||||
"name": "Andrea",
|
||||
"id": "pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Andrea',
|
||||
id: 'pTtVXDJaxtXcrlbG8B43Wom67snoeO24RNEkO6eB2BaIftTdvpnfe1QR65DVj9A6I3VOoKZkYQW',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Hannah",
|
||||
"id": "ojCjJqIXfNkOunHD9v2gQSNXRUQPzZCJzzuPTKyQy5TiyZ83ziHMvr2ZzDLWMb4M6dXqa8rN3O3",
|
||||
"userType": "killed",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": true,
|
||||
"killed": true,
|
||||
"revealed": true
|
||||
name: 'Hannah',
|
||||
id: 'ojCjJqIXfNkOunHD9v2gQSNXRUQPzZCJzzuPTKyQy5TiyZ83ziHMvr2ZzDLWMb4M6dXqa8rN3O3',
|
||||
userType: 'killed',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: true,
|
||||
killed: true,
|
||||
revealed: true
|
||||
},
|
||||
{
|
||||
"name": "Greg",
|
||||
"id": "1o2IntIivHV4pMqV2iMBi3lrMloHcShQiXObuedyc1DqeUho5aD0DI6Vqhja97c1GIMNzfyNC4a",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Greg',
|
||||
id: '1o2IntIivHV4pMqV2iMBi3lrMloHcShQiXObuedyc1DqeUho5aD0DI6Vqhja97c1GIMNzfyNC4a',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Jerret",
|
||||
"id": "eaxAqb1nj25jqWHnsWirSdYjLhHQVkQtnIkC4eHvmuleN7FtaG8XYnLJnBv4hhFvXWNbUguTrLJ",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Jerret',
|
||||
id: 'eaxAqb1nj25jqWHnsWirSdYjLhHQVkQtnIkC4eHvmuleN7FtaG8XYnLJnBv4hhFvXWNbUguTrLJ',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Lys",
|
||||
"id": "v2eOvaYKusGfiUpuZWTCJ0JUiESC29OuH6fpivwMuwcqizpYTCAzetrPl7fF8F5CoR35pTMIKxh",
|
||||
"userType": "player",
|
||||
"gameRole": "Werewolf",
|
||||
"gameRoleDescription": "During the night, choose a villager to kill. Don't get killed.",
|
||||
"alignment": "evil",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Lys',
|
||||
id: 'v2eOvaYKusGfiUpuZWTCJ0JUiESC29OuH6fpivwMuwcqizpYTCAzetrPl7fF8F5CoR35pTMIKxh',
|
||||
userType: 'player',
|
||||
gameRole: 'Werewolf',
|
||||
gameRoleDescription: "During the night, choose a villager to kill. Don't get killed.",
|
||||
alignment: 'evil',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Matt",
|
||||
"id": "pUDrpiGF1vuMfhztT2KY9bllBoGILVl2vIpRWVFH27SnqGiVP3LunjO0wy0otXToWzwbXBlx7ga",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Matt',
|
||||
id: 'pUDrpiGF1vuMfhztT2KY9bllBoGILVl2vIpRWVFH27SnqGiVP3LunjO0wy0otXToWzwbXBlx7ga',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Steve",
|
||||
"id": "Csz1haKdNa3WLIbqllRwV2e9TgwMlDoQwzbpZkTa0JhioUT5MD1GopUHU90f6cyfQ2Uv7YBTZo1",
|
||||
"userType": "player",
|
||||
"gameRole": "Villager",
|
||||
"gameRoleDescription": "During the day, find the wolves and kill them.",
|
||||
"alignment": "good",
|
||||
"out": false,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Steve',
|
||||
id: 'Csz1haKdNa3WLIbqllRwV2e9TgwMlDoQwzbpZkTa0JhioUT5MD1GopUHU90f6cyfQ2Uv7YBTZo1',
|
||||
userType: 'player',
|
||||
gameRole: 'Villager',
|
||||
gameRoleDescription: 'During the day, find the wolves and kill them.',
|
||||
alignment: 'good',
|
||||
out: false,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Alec",
|
||||
"id": "w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4",
|
||||
"userType": "moderator",
|
||||
"gameRole": null,
|
||||
"gameRoleDescription": null,
|
||||
"alignment": null,
|
||||
"out": true,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Alec',
|
||||
id: 'w8qarnG6FgAZQvRYsAFefldwU2r6KIeOce3nGaLxnfMlKIBOLj0DhUSC951bQ7yLwbRjDAS72r4',
|
||||
userType: 'moderator',
|
||||
gameRole: null,
|
||||
gameRoleDescription: null,
|
||||
alignment: null,
|
||||
out: true,
|
||||
killed: false,
|
||||
revealed: false
|
||||
},
|
||||
{
|
||||
"name": "Stav",
|
||||
"id": "BKfs1N0cfvwc309eOdwrTeum8NScSX7S8CTCGXgiI6JZufjAgD4WAdkkryn3sqIqKeswCFpIuTc",
|
||||
"userType": "spectator",
|
||||
"gameRole": null,
|
||||
"gameRoleDescription": null,
|
||||
"alignment": null,
|
||||
"out": true,
|
||||
"killed": false,
|
||||
"revealed": false
|
||||
name: 'Stav',
|
||||
id: 'BKfs1N0cfvwc309eOdwrTeum8NScSX7S8CTCGXgiI6JZufjAgD4WAdkkryn3sqIqKeswCFpIuTc',
|
||||
userType: 'spectator',
|
||||
gameRole: null,
|
||||
gameRoleDescription: null,
|
||||
alignment: null,
|
||||
out: true,
|
||||
killed: false,
|
||||
revealed: false
|
||||
}
|
||||
],
|
||||
"timerParams": {
|
||||
"hours": null,
|
||||
"minutes": 10,
|
||||
"paused": true,
|
||||
"timeRemaining": 600000
|
||||
timerParams: {
|
||||
hours: null,
|
||||
minutes: 10,
|
||||
paused: true,
|
||||
timeRemaining: 600000
|
||||
},
|
||||
"isFull": true
|
||||
isFull: true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,11 +3,9 @@ const Game = require('../../../../server/model/Game');
|
||||
const globals = require('../../../../server/config/globals');
|
||||
const USER_TYPES = globals.USER_TYPES;
|
||||
const STATUS = globals.STATUS;
|
||||
const Person = require('../../../../server/model/Person');
|
||||
const GameManager = require('../../../../server/modules/singletons/GameManager.js');
|
||||
const TimerManager = require('../../../../server/modules/singletons/TimerManager.js');
|
||||
const EventManager = require('../../../../server/modules/singletons/EventManager.js');
|
||||
const GameStateCurator = require('../../../../server/modules/GameStateCurator.js');
|
||||
const logger = require('../../../../server/modules/Logger.js')(false);
|
||||
|
||||
describe('GameManager', () => {
|
||||
@@ -23,7 +21,7 @@ describe('GameManager', () => {
|
||||
gameManager = GameManager.instance ? GameManager.instance : new GameManager(logger, globals.ENVIRONMENT.PRODUCTION, 'test');
|
||||
timerManager = TimerManager.instance ? TimerManager.instance : new TimerManager(logger, 'test');
|
||||
eventManager = EventManager.instance ? EventManager.instance : new EventManager(logger, 'test');
|
||||
eventManager.publisher = { publish: async (...a) => {} }
|
||||
eventManager.publisher = { publish: async (...a) => {} };
|
||||
gameManager.eventManager = eventManager;
|
||||
gameManager.timerManager = timerManager;
|
||||
gameManager.setGameSocketNamespace(namespace);
|
||||
@@ -52,7 +50,6 @@ describe('GameManager', () => {
|
||||
});
|
||||
|
||||
describe('#joinGame', () => {
|
||||
|
||||
it('should mark the game as full when all players have been assigned', async () => {
|
||||
await gameManager.joinGame(game, 'Jill', 'x');
|
||||
|
||||
@@ -74,14 +71,13 @@ describe('GameManager', () => {
|
||||
describe('#restartGame', () => {
|
||||
let shuffleSpy;
|
||||
|
||||
|
||||
beforeEach(() => {
|
||||
shuffleSpy = spyOn(gameManager, 'shuffle').and.stub();
|
||||
});
|
||||
|
||||
it('should reset all relevant game parameters', async () => {
|
||||
game.status = STATUS.ENDED;
|
||||
let player = game.people.find(p => p.id === 'b');
|
||||
const player = game.people.find(p => p.id === 'b');
|
||||
player.userType = USER_TYPES.KILLED_PLAYER;
|
||||
player.killed = true;
|
||||
player.out = true;
|
||||
@@ -100,10 +96,10 @@ describe('GameManager', () => {
|
||||
it('should reset all relevant game parameters, including when the game has a timer', async () => {
|
||||
game.timerParams = { hours: 2, minutes: 2, paused: false };
|
||||
game.hasTimer = true;
|
||||
timerManager.timerThreads = { 'ABCD': { kill: () => {} } };
|
||||
timerManager.timerThreads = { ABCD: { kill: () => {} } };
|
||||
game.status = STATUS.ENDED;
|
||||
|
||||
const threadKillSpy = spyOn(timerManager.timerThreads['ABCD'], 'kill');
|
||||
const threadKillSpy = spyOn(timerManager.timerThreads.ABCD, 'kill');
|
||||
const runTimerSpy = spyOn(timerManager, 'runTimer').and.stub();
|
||||
const emitSpy = spyOn(namespace.in(), 'emit');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user