Created
January 26, 2019 14:35
-
-
Save zulucoda/71dc53500122525b3898fdcfdb540935 to your computer and use it in GitHub Desktop.
Unit Test - Login Sagas
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
describe('Unit Test - Login Sagas', () => { | |
describe('userLoginSagaRefactor', () => { | |
describe('when user is authorised', () => { | |
it('should yield userLoginSagaRefactor saga, which yields getLoginFormState, yield authoriseUser yield LoginActions.clearLogin and yield getUserSettingsSaga', () => { | |
const generator = userLoginSagaRefactor(); | |
expect(generator.next().value).toEqual(select(getLoginFormState)); | |
expect( | |
generator.next({ | |
username: 'some username', | |
password: 'some password', | |
}).value, | |
).toEqual(call(authoriseUserSaga, 'some username', 'some password')); | |
expect(generator.next(true).value).toEqual( | |
put(LoginActions.clearLogin()), | |
); | |
expect(generator.next().value).toEqual(call(getUserSettingsSaga)); | |
expect(generator.next().done).toBeTruthy(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment