@@ -9,7 +9,7 @@ import { themeDark } from '../../src/styles/themes/theme.dark';
9
9
import styleLight from '../../src/styles/hljs/hljs.light' ;
10
10
import styleDark from '../../src/styles/hljs/hljs.dark' ;
11
11
import Game from '../../src/pages/Game' ;
12
- import { RESTART } from '../../src/static/constants/actions' ;
12
+ import { START , RESTART } from '../../src/static/constants/actions' ;
13
13
14
14
const patterns = [
15
15
{
@@ -43,6 +43,7 @@ const store = mockStore({
43
43
remaining : [ patterns [ 1 ] ] ,
44
44
current : patterns [ 0 ]
45
45
} ,
46
+ intro : false ,
46
47
mode : 'light' ,
47
48
js : 'es5'
48
49
} ) ;
@@ -115,6 +116,41 @@ describe('Game page - GAME - DARK style', () => {
115
116
} ) ;
116
117
} ) ;
117
118
119
+ describe ( 'Game page - INTRO' , ( ) => {
120
+ let tree ;
121
+ const store = mockStore ( {
122
+ patterns : patterns ,
123
+ progress : {
124
+ answers : patterns ,
125
+ remaining : [ ] ,
126
+ current : null
127
+ } ,
128
+ intro : true ,
129
+ mode : 'light' ,
130
+ js : 'es5'
131
+ } ) ;
132
+
133
+ beforeEach ( ( ) => {
134
+ tree = mount (
135
+ < Provider store = { store } >
136
+ < ThemeProvider theme = { themeLight } >
137
+ < Game style = { styleLight } />
138
+ </ ThemeProvider >
139
+ </ Provider >
140
+ ) ;
141
+ } ) ;
142
+
143
+ it ( 'renders a <Button /> component' , ( ) => {
144
+ expect ( tree . find ( 'Button' ) ) . toMatchSnapshot ( ) ;
145
+ } ) ;
146
+
147
+ it ( 'reacts to button click' , ( ) => {
148
+ tree . find ( 'button' ) . simulate ( 'click' ) ;
149
+ const actions = store . getActions ( ) ;
150
+ expect ( actions ) . toMatchObject ( [ { type : START } ] ) ;
151
+ } ) ;
152
+ } ) ;
153
+
118
154
describe ( 'Game page - RESULTS' , ( ) => {
119
155
let tree ;
120
156
const patterns = [
@@ -147,6 +183,7 @@ describe('Game page - RESULTS', () => {
147
183
remaining : [ ] ,
148
184
current : null
149
185
} ,
186
+ intro : false ,
150
187
mode : 'light' ,
151
188
js : 'es5'
152
189
} ) ;
0 commit comments