Created
February 20, 2019 10:08
-
-
Save charisschomba/8cc019739427dc761ebaac66b64a42e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
REGISTER_USER, | |
REGISTER_SUCCESS, | |
REGISTER_ERROR, | |
} from '../../../constants/users'; | |
import addUser from '../../../store/reducers/users'; | |
import initialState, { | |
initialStateEdit, | |
} from '../../../__mocks__/initialState'; | |
const action = { payload: {} }; | |
describe('User Reducer test', () => { | |
it('should return initial state when there is no action', () => { | |
expect(addUser(initialState, action)).toEqual(initialState); | |
}); | |
it('should handle EDIT_USER', () => { | |
action.type = REGISTER_USER; | |
expect(addUser(initialState, action).success).toEqual(false); | |
}); | |
it('should handle USER_EDIT_SUCCESS', () => { | |
action.type = REGISTER_SUCCESS; | |
expect(addUser(initialStateEdit, action).success).toEqual(true); | |
}); | |
it('should handle USER_EDIT_ERROR', () => { | |
action.type = REGISTER_ERROR; | |
expect(addUser(initialStateEdit, action).success).toEqual(false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment