Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const startLogout = () => {
- return ( dispatch ) => {
- return firebase
- .auth()
- .signOut()
- .then(() => {
- dispatch( logout() );
- history.push( '/login' );
- })
- .catch( ( err ) => {
- // Simple redirect to non existent route
- history.push( '/oops' );
- console.log( err );
- });
- };
- test( 'should start logout', ( done ) => {
- const store = createMockStore({});
- store.dispatch( startLogout() ).then(() => {
- const actions = store.getActions();
- expect( actions[0] ).toEqual({
- type: LOGOUT
- });
- const history = { push: jest.fn() };
- expect( history.push ).toHaveBeenLastCalledWith( '/login' );
- done();
- }).catch((err) => {
- console.log( err );
- done();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement