Skip to content

TestStore Changing Environment Variable #490

Answered by mbrandonw
natemann asked this question in Q&A
Discussion options

You must be logged in to vote

I think I see what is going on here, and it's tricky.

The change you make to the environment to replace the $0.download endpoint doesn't actually update the environment in the flatMap. The flatMap will capture the environment at the time of sending the .start action, and will never change after that. In fact, that kinda makes using environment inside .flatMaps a little dangerous, in particular when flat mapping from a long living effect like a timer. We should add some documentation/case studies for this behavior.

One thing you should be able to do to work around is use a PassthroughSubject for environment.download in your test and then send it values to emulate the download effect firing…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by natemann
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants