Created
March 13, 2017 06:15
-
-
Save gyver98/f482176b8c904a9ef1c64becb87b8023 to your computer and use it in GitHub Desktop.
teslaRangeApp.spec.js
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
import appReducer from './teslaRangeApp'; | |
const initialState = { | |
carstats:[ | |
{miles:246, model:"60"}, | |
{miles:250, model:"60D"}, | |
{miles:297, model:"75"}, | |
{miles:306, model:"75D"}, | |
{miles:336, model:"90D"}, | |
{miles:376, model:"P100D"} | |
], | |
config: { | |
speed: 55, | |
temperature: 20, | |
climate: true, | |
wheels: 19 | |
} | |
} | |
const climateChangeState = { | |
carstats:[ | |
{miles:267, model:"60"}, | |
{miles:273, model:"60D"}, | |
{miles:323, model:"75"}, | |
{miles:334, model:"75D"}, | |
{miles:366, model:"90D"}, | |
{miles:409, model:"P100D"} | |
], | |
config: { | |
speed: 55, | |
temperature: 20, | |
climate: false, | |
wheels: 19 | |
} | |
} | |
describe('test reducer', () => { | |
it('should handle initial stat', () => { | |
expect( | |
appReducer(undefined, {}) | |
).toEqual(initialState) | |
}) | |
it('should handle CHANGE_CLIMATE', () => { | |
expect( | |
appReducer(initialState,{ | |
type: 'CHANGE_CLIMATE' | |
}) | |
).toEqual(climateChangeState) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment