-
Notifications
You must be signed in to change notification settings - Fork 885
/
video-games-test.js
119 lines (93 loc) · 4.97 KB
/
video-games-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var { createPlayer } = require('./video-games');
var assert = require('chai').assert;
describe('video games', function () {
it.skip('should create a new player with a name and an age', function () {
var player1 = createPlayer('Ace Skateboarder', 19);
assert.equal(player1.name, 'Ace Skateboarder');
assert.equal(player1.age, 19);
});
it.skip('should create another player with a name and an age', function () {
var player1 = createPlayer('Guitar Heroine', 25);
var player2 = createPlayer('Time Traveler', 35);
assert.equal(player1.name, 'Guitar Heroine');
assert.equal(player1.age, 25);
assert.equal(player2.name, 'Time Traveler');
assert.equal(player2.age, 35);
});
it.skip('should create a new player with a unique moveset', function () {
var player1 = createPlayer('Super Skater', 27, ['super jump', 'board smash', 'grind rail']);
assert.equal(player1.name, 'Super Skater');
assert.equal(player1.age, 27);
assert.deepEqual(player1.moveset['super jump', 'board smash', 'grind rail']);
});
it.skip('should be able to create a new level with a name', function () {
var level = createLevel('Island Oasis');
assert.equal(level.name, 'Island Oasis');
});
it.skip('should be able to create a new level with a name and a player', function () {
var player1 = createPlayer('The Future Savior', 18, ['time travel', 'combat training', 'futuristic weapon']);
var level = createLevel('Zombie Infested City', [player1]);
assert.equal(level.name, 'Zombie Infested City');
assert.deepEqual(level.players, [player1]);
});
it.skip('should be able to create a new level with a name and many players', function () {
var player1 = createPlayer('Rock Star Rebel', 21, ['power chord', 'stage dive', 'crowd surf']);
var player2 = createPlayer('Pro Skater Prodigy', 16, ['360 flip', 'board slide', 'gap transfer']);
var level = createLevel('Candy Cane Canyon', [player1, player2]);
assert.equal(level.name, 'Candy Cane Canyon');
assert.deepEqual(level.players, [player1, player2]);
});
it.skip('should initiate a level with a player and 3 lives and 0 coins', function () {
var player1 = createPlayer('Quantum Jumper', 30, ['dimension jump', 'portal creation', 'alternate reality explosion']);
var level = createLevel('Carnival of Terror', [player1]);
assert.equal(level.name, 'Carnival of Terror');
assert.deepEqual(level.players, [player1]);
assert.equal(level.coins, 0);
assert.equal(level.lives, 3);
});
it.skip('should be able to collect coins', function () {
var player1 = createPlayer('The Timeless Troubadour', 500, ['piano sonata', 'violin concerto', 'fllamenco guitar']);
var level = createLevel('Infernal Inferno of Flames', [player1]);
assert.equal(level.name, 'Infernal Inferno of Flames');
assert.deepEqual(level.players, [player1]);
assert.equal(level.coins, 0);
assert.equal(level.lives, 3);
var updatedLevel = findCoins(level, 5);
assert.equal(updatedLevel.coins, 5);
});
it.skip('should add a life when 100 coins are collected', function () {
var player1 = createPlayer('The Fiery Friar', 50, ['flame spin', 'fire dance', 'smoke screen']);
var level = createLevel('Water Temple', [player1]);
assert.equal(level.name, 'Water Temple');
assert.deepEqual(level.players, [player1]);
assert.equal(level.coins, 0);
assert.equal(level.lives, 3);
var updatedLevel = findCoins(level, 100);
assert.equal(updatedLevel.coins, 100);
assert.equal(level.lives, 4);
});
it.skip('should be able to defeat the player and cost a life', function () {
var player1 = createPlayer('Tony Thrasher', 34, ['thrash throw', 'solving mysteries', 'thrash dance']);
var level = createLevel('Alien Outpost', [player1]);
assert.equal(level.name, 'Alien Outpost');
assert.deepEqual(level.players, [player1]);
assert.equal(level.coins, 0);
assert.equal(level.lives, 3);
var updatedLevelPlayerFell = defeatPlayer(level);
assert.equal(updatedLevelPlayerFell.lives, 2);
});
it.skip('should print `GAME OVER` when a player is defeated and has no lives left', function () {
var player1 = createPlayer('Ant Cat', 3, ['tiny roar', 'six-legged claws', 'dig tunnel']);
var level = createLevel('Alien Outpost', [player1]);
assert.equal(level.name, 'Alien Outpost');
assert.deepEqual(level.players, [player1]);
assert.equal(level.coins, 0);
assert.equal(level.lives, 3);
var updatedLevelPlayerDefeated = defeatPlayer(level);
assert.equal(updatedLevelPlayerDefeated.lives, 2);
var updatedLevelPlayerAnnihilated = defeatPlayer(updatedLevelPlayerDefeated);
assert.equal(updatedLevelPlayerAnnihilated.lives, 1);
var updatedLevelPlayerDestroyed = defeatPlayer(updatedLevelPlayerAnnihilated);
assert.equal(updatedLevelPlayerDestroyed, 'GAME OVER');
});
});