Cannot find anything, I was creating a unit test case for some function but while mocking every function, there is a line of code:
yield take({Action_Name})
that is creating an error
: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error:
How do I invoke this action, so that my process would continue executing
Here is some snip of the function:
export function* create(action) {
try {
const response = yield call(
rest.create
);
yield call(db.create, response.data);
yield call(
local.save,
response.data.id
);
yield put({
type: CREATE_SUCCESS,
payload: response.data,
});
const ae = yield select(getActiveWallet);
const info = parseInfo(ae);
yield take(STOP_BACKGROUND_SUCCESS);
const payload = {
title: 'Creation Success',
message: 'You successfully created.',
redirect: 'link',
};
yield put({
type: SHOW_ALERT_BOX,
payload,
});
} catch (err) {
yield put({
type: CREATE_ERROR,
errorObj: err,
errorMessage: err.message,
});
}
}
Edit: Found that some functions are invoking in UI due to the lifeCycle method(useEffect) but how do I replicate/call those in my test function?