Skip to content
New issue

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

Refactor this redundant 'await' on a non-promise.sonarlint(typescript:S4123) #381

Open
rkaartikeyan opened this issue Feb 17, 2022 · 0 comments

Comments

@rkaartikeyan
Copy link

Hi everyone,

thanks for this great library. In my project I am getting bellow error on await expectSaga

Refactor this redundant 'await' on a non-promise.sonarlint(typescript:S4123)

saga.test.ts

it('validate watchFetch', async () => {
    store.dispatch(watchFetch({id: 1001}));

    const effects = await expectSaga(watchFetch)
      .put(setInfo({id: 1000, name: 'test'}))
      .dispatch({type: 'user/fetch'});

    effects.silentRun();
  });

sage.ts

// fetch worker
function* fetch(action){
  const {data} = yield(call(Api, {url: '...', params: {id: action.payload.id}}));
  put(setInfo(data));
}

// fetch watcher
function* watchFetch() {
  yield takeLatest(
    'user/fetch',
    fetch,
  );
}

if I remove the async and await then put() is not covered in fetch()...

Please let me know what did I missed here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant