Skip to content

How to properly use dependencies in tests, without TCA #102

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

You must be logged in to vote

Hi @Pomanks, thanks for the sample project. That helps us see what is going on.

Unfortunately you have a pretty complex set up right now, and if you trace through everything, what you are experience is to be expected. The productManager is depending on the connectionManager at the moment of access of the liveValue, which means the mere act of trying to override the dependency to the live value resolves the connectionManager, which has no choice but to choose the testValue since it has not yet been override to its liveValue.

I can think of 3 options to work around this.

  • This first is the most work, but I think it's probably the most correct. While it is ok to bind the @Dependency(\.conne…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@mbrandonw
Comment options

Answer selected by Pomanks
@Pomanks
Comment options

@mbrandonw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants