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

stubFork? #1

Open
ixje opened this issue Oct 29, 2017 · 2 comments
Open

stubFork? #1

ixje opened this issue Oct 29, 2017 · 2 comments

Comments

@ixje
Copy link

ixje commented Oct 29, 2017

Hey,

I'm currently trying out this package and noticed there is no stubFork in the package. Taking the blind man approach I copied most of the stubCall code and made some minor adjustments to make it work (thus far) for my needs.

So far I haven't encountered any problems, but I also didn't give the implementation much thought. Given that there was already some code related to forks (e.g. forkGeneratorFn) it makes me wonder why stubFork wasn't present. Care to shed a light? Was it just not considered? Perhaps a time constraint, or are there known issues/limitations with the simplistic approach I've taken?

Hope to hear from you.

@mpolci
Copy link
Contributor

mpolci commented Oct 29, 2017

stubFork was not considered but should be easy to add it, you can submit a pull request. The actual code related to forks is to traverse the tree of effects generated by a fork with a generator function.

@ixje
Copy link
Author

ixje commented Oct 30, 2017

I don't think my (PR)[https://github.com//pull/2] does what you have in mind. I basically use it like the stubCall where I can return my own value. e.g.
saga

        yield fork(walletUseFlow, params)
        const action = yield take([actionMsg.wallet.LOGOUT, actionMsg.wallet.LOGIN_ERROR])
        if (action.type == actionMsg.wallet.LOGOUT) { // do something }

test specific branch

            testSaga.stubFork(walletUseFlow, () => {
                sagaTester.dispatch({ type: actionMsg.wallet.LOGOUT })
            })

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

2 participants