Skip to content

Commit 5eccbd2

Browse files
committed
unit test more game flow
1 parent 18a7e8c commit 5eccbd2

File tree

4 files changed

+443
-9
lines changed

4 files changed

+443
-9
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`The audio will set the Audio component 1`] = `
4+
Array [
5+
<audio
6+
key="winnerAudio"
7+
src={
8+
Object {
9+
"canInstrument": true,
10+
"createTransformer": [Function],
11+
"getCacheKey": [Function],
12+
"getCacheKeyAsync": [Function],
13+
"process": [Function],
14+
"processAsync": [Function],
15+
}
16+
}
17+
>
18+
<track
19+
kind="captions"
20+
/>
21+
</audio>,
22+
<audio
23+
key="looserAudio"
24+
src={
25+
Object {
26+
"canInstrument": true,
27+
"createTransformer": [Function],
28+
"getCacheKey": [Function],
29+
"getCacheKeyAsync": [Function],
30+
"process": [Function],
31+
"processAsync": [Function],
32+
}
33+
}
34+
>
35+
<track
36+
kind="captions"
37+
/>
38+
</audio>,
39+
<audio
40+
key="clearAudio"
41+
src={
42+
Object {
43+
"canInstrument": true,
44+
"createTransformer": [Function],
45+
"getCacheKey": [Function],
46+
"getCacheKeyAsync": [Function],
47+
"process": [Function],
48+
"processAsync": [Function],
49+
}
50+
}
51+
>
52+
<track
53+
kind="captions"
54+
/>
55+
</audio>,
56+
<audio
57+
key="maxClearAudio"
58+
src={
59+
Object {
60+
"canInstrument": true,
61+
"createTransformer": [Function],
62+
"getCacheKey": [Function],
63+
"getCacheKeyAsync": [Function],
64+
"process": [Function],
65+
"processAsync": [Function],
66+
}
67+
}
68+
>
69+
<track
70+
kind="captions"
71+
/>
72+
</audio>,
73+
]
74+
`;

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

Lines changed: 130 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,32 @@ exports[`The Game component will display the game for allowed screen sizes 1`] =
7272
minorCanvas={
7373
Object {
7474
"current": Object {
75-
"focus": [MockFunction],
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+
},
76101
"getContext": [Function],
77102
"style": Object {
78103
"backgroundColor": "black",
@@ -104,7 +129,32 @@ exports[`The Game component will display the game for allowed screen sizes 1`] =
104129
clearAudio={
105130
Object {
106131
"current": Object {
107-
"focus": [MockFunction],
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+
},
108158
"getContext": [Function],
109159
"style": Object {},
110160
},
@@ -113,7 +163,32 @@ exports[`The Game component will display the game for allowed screen sizes 1`] =
113163
looserAudio={
114164
Object {
115165
"current": Object {
116-
"focus": [MockFunction],
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+
},
117192
"getContext": [Function],
118193
"style": Object {},
119194
},
@@ -122,7 +197,32 @@ exports[`The Game component will display the game for allowed screen sizes 1`] =
122197
maxClearAudio={
123198
Object {
124199
"current": Object {
125-
"focus": [MockFunction],
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+
},
126226
"getContext": [Function],
127227
"style": Object {},
128228
},
@@ -131,7 +231,32 @@ exports[`The Game component will display the game for allowed screen sizes 1`] =
131231
winnerAudio={
132232
Object {
133233
"current": Object {
134-
"focus": [MockFunction],
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+
},
135260
"getContext": [Function],
136261
"style": Object {},
137262
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import { shallow } from 'enzyme';
3+
import toJson from 'enzyme-to-json';
4+
import { Audio } from '../../../../src/components/game/audio';
5+
6+
describe('The audio', () => {
7+
test('will set the Audio component', () => {
8+
const wrapper = shallow(<Audio />);
9+
expect(toJson(wrapper)).toMatchSnapshot();
10+
});
11+
});

0 commit comments

Comments
 (0)