Created
October 23, 2018 08:03
-
-
Save tiagogomes772/5ca419f44d100616909c64c62c251cdd to your computer and use it in GitHub Desktop.
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 Reducer from './Reducer'; | |
describe('reducer', () => { | |
it('should handle the Action REQUEST_ADVICE', () => { | |
expect( | |
Reducer( | |
{ | |
fetching: false, | |
randomAdvice: null, | |
}, | |
{ | |
type: 'REQUEST_ADVICE', | |
}, | |
), | |
).toEqual({ | |
fetching: true, | |
randomAdvice: null, | |
}); | |
}); | |
it('should handle the Action RESPONSE_ADVICE_FAILURE', () => { | |
expect( | |
Reducer( | |
{ | |
fetching: true, | |
}, | |
{ | |
type: 'RESPONSE_ADVICE_FAILURE', | |
}, | |
), | |
).toEqual({ | |
fetching: false, | |
}); | |
}); | |
it('should handle the Action RESPONSE_ADVICE_SUCCESS', () => { | |
expect( | |
Reducer( | |
{ | |
fetching: false, | |
randomAdvice: null, | |
}, | |
{ | |
type: 'RESPONSE_ADVICE_SUCCESS', | |
payload: 'Random advice inserted', | |
}, | |
), | |
).toEqual({ | |
fetching: false, | |
randomAdvice: 'Random advice inserted', | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment