We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I have a callback function in payload. Please tell me how to call that callback function when testSaga.
My saga.js export const sumTwoNumbers = function* ({ payload: { a, b, onSuccess } }) { try { let sum = a + b; yield put(sumTwoNumbersSuccess()); yield call(onSuccess(sum)); } catch(e) { console.log(e) } };
My saga.test.js
describe('sum two numbers', () => { const actionPayload = { type: 'SUM_TWO_NUMBER', payload: { a: 5, b: 6, onSuccess: () => 11, }, };
it('should sum two numbers success', () => { testSaga(sumTwoNumbers, actionPayload) .next() .put(sumTwoNumbersSuccess()) .next() .isDone(); }); });
I want to call onSuccess function in unit test. Please help me! Thanks so much!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I have a callback function in payload. Please tell me how to call that callback function when testSaga.
My saga.js
export const sumTwoNumbers = function* ({ payload: { a, b, onSuccess } }) {
try {
let sum = a + b;
yield put(sumTwoNumbersSuccess());
yield call(onSuccess(sum));
} catch(e) {
console.log(e)
}
};
My saga.test.js
describe('sum two numbers', () => {
const actionPayload = {
type: 'SUM_TWO_NUMBER',
payload: {
a: 5,
b: 6,
onSuccess: () => 11,
},
};
it('should sum two numbers success', () => {
testSaga(sumTwoNumbers, actionPayload)
.next()
.put(sumTwoNumbersSuccess())
.next()
.isDone();
});
});
I want to call onSuccess function in unit test.
Please help me!
Thanks so much!
The text was updated successfully, but these errors were encountered: