@@ -9,7 +9,7 @@ import { themeDark } from '../../src/styles/themes/theme.dark';
99import styleLight from '../../src/styles/hljs/hljs.light' ;
1010import styleDark from '../../src/styles/hljs/hljs.dark' ;
1111import Game from '../../src/pages/Game' ;
12- import { RESTART } from '../../src/static/constants/actions' ;
12+ import { START , RESTART } from '../../src/static/constants/actions' ;
1313
1414const patterns = [
1515 {
@@ -43,6 +43,7 @@ const store = mockStore({
4343 remaining : [ patterns [ 1 ] ] ,
4444 current : patterns [ 0 ]
4545 } ,
46+ intro : false ,
4647 mode : 'light' ,
4748 js : 'es5'
4849} ) ;
@@ -115,6 +116,41 @@ describe('Game page - GAME - DARK style', () => {
115116 } ) ;
116117} ) ;
117118
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+
118154describe ( 'Game page - RESULTS' , ( ) => {
119155 let tree ;
120156 const patterns = [
@@ -147,6 +183,7 @@ describe('Game page - RESULTS', () => {
147183 remaining : [ ] ,
148184 current : null
149185 } ,
186+ intro : false ,
150187 mode : 'light' ,
151188 js : 'es5'
152189 } ) ;
0 commit comments