-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove GamePage test for old 'trying-out' code"
This reverts commit 604a002.
- Loading branch information
1 parent
604a002
commit 14bd2ee
Showing
2 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
143 changes: 143 additions & 0 deletions
143
game_frontend/src/containers/GamePage/__snapshots__/index.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<GamePage /> should render successfully with no movies 1`] = ` | ||
ShallowWrapper { | ||
"length": 1, | ||
Symbol(enzyme.__root__): [Circular], | ||
Symbol(enzyme.__unrendered__): <GamePage | ||
movies={Array []} | ||
/>, | ||
Symbol(enzyme.__renderer__): Object { | ||
"batchedUpdates": [Function], | ||
"getNode": [Function], | ||
"render": [Function], | ||
"simulateEvent": [Function], | ||
"unmount": [Function], | ||
}, | ||
Symbol(enzyme.__node__): Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "function", | ||
"props": Object { | ||
"children": Array [ | ||
<div> | ||
Welcome to the AIMMO game screen | ||
</div>, | ||
<styled.button | ||
id="fetch-movies-button" | ||
onClick={[Function]} | ||
> | ||
Get the GhibliMovies! | ||
</styled.button>, | ||
<ul />, | ||
], | ||
}, | ||
"ref": null, | ||
"rendered": Array [ | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "host", | ||
"props": Object { | ||
"children": "Welcome to the AIMMO game screen", | ||
}, | ||
"ref": null, | ||
"rendered": "Welcome to the AIMMO game screen", | ||
"type": "div", | ||
}, | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object { | ||
"children": "Get the GhibliMovies!", | ||
"id": "fetch-movies-button", | ||
"onClick": [Function], | ||
}, | ||
"ref": null, | ||
"rendered": "Get the GhibliMovies!", | ||
"type": [Function], | ||
}, | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "host", | ||
"props": Object { | ||
"children": Array [], | ||
}, | ||
"ref": null, | ||
"rendered": Array [], | ||
"type": "ul", | ||
}, | ||
], | ||
"type": Symbol(react.fragment), | ||
}, | ||
Symbol(enzyme.__nodes__): Array [ | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "function", | ||
"props": Object { | ||
"children": Array [ | ||
<div> | ||
Welcome to the AIMMO game screen | ||
</div>, | ||
<styled.button | ||
id="fetch-movies-button" | ||
onClick={[Function]} | ||
> | ||
Get the GhibliMovies! | ||
</styled.button>, | ||
<ul />, | ||
], | ||
}, | ||
"ref": null, | ||
"rendered": Array [ | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "host", | ||
"props": Object { | ||
"children": "Welcome to the AIMMO game screen", | ||
}, | ||
"ref": null, | ||
"rendered": "Welcome to the AIMMO game screen", | ||
"type": "div", | ||
}, | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object { | ||
"children": "Get the GhibliMovies!", | ||
"id": "fetch-movies-button", | ||
"onClick": [Function], | ||
}, | ||
"ref": null, | ||
"rendered": "Get the GhibliMovies!", | ||
"type": [Function], | ||
}, | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "host", | ||
"props": Object { | ||
"children": Array [], | ||
}, | ||
"ref": null, | ||
"rendered": Array [], | ||
"type": "ul", | ||
}, | ||
], | ||
"type": Symbol(react.fragment), | ||
}, | ||
], | ||
Symbol(enzyme.__options__): Object { | ||
"adapter": ReactSixteenAdapter { | ||
"options": Object { | ||
"enableComponentDidUpdateOnSetState": true, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-env jest */ | ||
import ConnectedGamePage, { GamePage } from 'containers/GamePage' | ||
import configureStore from 'redux-mock-store' | ||
import { shallow } from 'enzyme' | ||
import shallowWithStore from 'containers/testHelpers/shallowWithStore' | ||
import React from 'react' | ||
|
||
describe('<GamePage />', () => { | ||
it('should render successfully with a mock store', () => { | ||
const testState = { | ||
movieReducer: { | ||
movies: [] | ||
} | ||
} | ||
|
||
const store = configureStore([])(testState) | ||
const component = shallowWithStore(<ConnectedGamePage />, store) | ||
|
||
expect(component.dive()).toBeDefined() | ||
}) | ||
|
||
it('should render successfully with no movies', () => { | ||
const props = { | ||
movies: [] | ||
} | ||
|
||
const component = shallow(<GamePage {...props} />) | ||
|
||
expect(component).toMatchSnapshot() | ||
}) | ||
|
||
it('should call fetchMovies when I click on the button', () => { | ||
const fetchMovies = jest.fn() | ||
const props = { | ||
movies: [], | ||
fetchMovies | ||
} | ||
|
||
const component = shallow(<GamePage {...props} />) | ||
|
||
component.find('#fetch-movies-button').simulate('click') | ||
expect(fetchMovies.mock.calls.length).toBe(1) | ||
}) | ||
}) |