Skip to content

Commit 18a7e8c

Browse files
committed
unit test game flow CDU
1 parent 8e4381d commit 18a7e8c

File tree

3 files changed

+145
-169
lines changed

3 files changed

+145
-169
lines changed

client/src/components/game/game.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@ export class Game extends React.Component {
183183
const { lastRefresh, requestAnimation, updateFloor } = this.state;
184184
const { game } = this.props;
185185
// console.log(timeStamp);
186-
187-
console.dir({ lastRefresh, timeStamp, updateFloor })
188186
if ((timeStamp - lastRefresh) >= game.timerInterval) {
189-
console.log('howdy')
190187
if (updateFloor) drawFloor(game, this.canvasContextMajor);
191188
this.setState({
192189
lastRefresh: timeStamp,
@@ -201,7 +198,6 @@ export class Game extends React.Component {
201198
};
202199

203200
endTick = (sentBy) => {
204-
console.log('In end tick')
205201
if (process.env.NODE_ENV === 'development') console.log(sentBy);
206202
this.setState({ requestAnimation: false });
207203
cancelAnimationFrame(this.animationId);

client/tests/src/components/game/__snapshots__/game.test.js.snap

Lines changed: 7 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`The Game will display message for small screen sizes 1`] = `
3+
exports[`The Game component will display message for small screen sizes 1`] = `
44
<div
55
id="landing"
66
>
@@ -10,7 +10,7 @@ exports[`The Game will display message for small screen sizes 1`] = `
1010
</div>
1111
`;
1212

13-
exports[`The Game will display the game for allowed screen sizes 1`] = `
13+
exports[`The Game component will display the game for allowed screen sizes 1`] = `
1414
<div
1515
id="landing"
1616
>
@@ -72,32 +72,7 @@ exports[`The Game will display the game for allowed screen sizes 1`] = `
7272
minorCanvas={
7373
Object {
7474
"current": Object {
75-
"focus": [MockFunction] {
76-
"calls": Array [
77-
Array [],
78-
Array [],
79-
Array [],
80-
Array [],
81-
],
82-
"results": Array [
83-
Object {
84-
"type": "return",
85-
"value": undefined,
86-
},
87-
Object {
88-
"type": "return",
89-
"value": undefined,
90-
},
91-
Object {
92-
"type": "return",
93-
"value": undefined,
94-
},
95-
Object {
96-
"type": "return",
97-
"value": undefined,
98-
},
99-
],
100-
},
75+
"focus": [MockFunction],
10176
"getContext": [Function],
10277
"style": Object {
10378
"backgroundColor": "black",
@@ -129,32 +104,7 @@ exports[`The Game will display the game for allowed screen sizes 1`] = `
129104
clearAudio={
130105
Object {
131106
"current": Object {
132-
"focus": [MockFunction] {
133-
"calls": Array [
134-
Array [],
135-
Array [],
136-
Array [],
137-
Array [],
138-
],
139-
"results": Array [
140-
Object {
141-
"type": "return",
142-
"value": undefined,
143-
},
144-
Object {
145-
"type": "return",
146-
"value": undefined,
147-
},
148-
Object {
149-
"type": "return",
150-
"value": undefined,
151-
},
152-
Object {
153-
"type": "return",
154-
"value": undefined,
155-
},
156-
],
157-
},
107+
"focus": [MockFunction],
158108
"getContext": [Function],
159109
"style": Object {},
160110
},
@@ -163,32 +113,7 @@ exports[`The Game will display the game for allowed screen sizes 1`] = `
163113
looserAudio={
164114
Object {
165115
"current": Object {
166-
"focus": [MockFunction] {
167-
"calls": Array [
168-
Array [],
169-
Array [],
170-
Array [],
171-
Array [],
172-
],
173-
"results": Array [
174-
Object {
175-
"type": "return",
176-
"value": undefined,
177-
},
178-
Object {
179-
"type": "return",
180-
"value": undefined,
181-
},
182-
Object {
183-
"type": "return",
184-
"value": undefined,
185-
},
186-
Object {
187-
"type": "return",
188-
"value": undefined,
189-
},
190-
],
191-
},
116+
"focus": [MockFunction],
192117
"getContext": [Function],
193118
"style": Object {},
194119
},
@@ -197,32 +122,7 @@ exports[`The Game will display the game for allowed screen sizes 1`] = `
197122
maxClearAudio={
198123
Object {
199124
"current": Object {
200-
"focus": [MockFunction] {
201-
"calls": Array [
202-
Array [],
203-
Array [],
204-
Array [],
205-
Array [],
206-
],
207-
"results": Array [
208-
Object {
209-
"type": "return",
210-
"value": undefined,
211-
},
212-
Object {
213-
"type": "return",
214-
"value": undefined,
215-
},
216-
Object {
217-
"type": "return",
218-
"value": undefined,
219-
},
220-
Object {
221-
"type": "return",
222-
"value": undefined,
223-
},
224-
],
225-
},
125+
"focus": [MockFunction],
226126
"getContext": [Function],
227127
"style": Object {},
228128
},
@@ -231,32 +131,7 @@ exports[`The Game will display the game for allowed screen sizes 1`] = `
231131
winnerAudio={
232132
Object {
233133
"current": Object {
234-
"focus": [MockFunction] {
235-
"calls": Array [
236-
Array [],
237-
Array [],
238-
Array [],
239-
Array [],
240-
],
241-
"results": Array [
242-
Object {
243-
"type": "return",
244-
"value": undefined,
245-
},
246-
Object {
247-
"type": "return",
248-
"value": undefined,
249-
},
250-
Object {
251-
"type": "return",
252-
"value": undefined,
253-
},
254-
Object {
255-
"type": "return",
256-
"value": undefined,
257-
},
258-
],
259-
},
134+
"focus": [MockFunction],
260135
"getContext": [Function],
261136
"style": Object {},
262137
},

0 commit comments

Comments
 (0)