Replies: 2 comments
-
A few options here... If not, you can also make this change on your own too! Just do something like
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Recently I started using this project (thanks point free for open sourcing) and I found a use case I wanted to use and I couldn't find any help in this repo.
Wondering if I could get some feedback on my approach.
Hoping that by providing a wrong answer I end up getting a right one.
I have an app that lets you view files (Think Dropbox/Files.app) and from the Root of the app you either are shown a Login page - or a List of Files. You can't use the app without authentication.
I determine which view to show using a
SwitchStore
with aCaseLet
;Inside this
AppContext
store I have a few dependencies. I am effectively using theAppContext
as a dependency container for all the apps required dependencies.So far, so good.
Then in some other places in the code, for example in Clients (that handle talking to an API and converting responses to a Domain Model, I will have a dependency on this
AppContext
so I can use those shared dependencies.I wrote my Unit Tests using a
TestStore
which allowed me to swap out those dependencies for mocks, worked very well.But then I got to UITests...
As far as I know I can't force the UI Test app to use test dependencies using the
ComposableArchitecture
library.I looked for some example UI Tests in the repo and couldn't see any way to get the host app to swap out live dependencies to test ones, so I ended up doing the following;
Wrapped
context that will swap out dependencies (notice that the state and actions are of the type used in AppContext so I can use this in my Rootview)isLive
flagNow it works and my dependencies are correct based on the context the app is running. However, this feels weird and odd to me to do this. Is there something I am doing wrong and is there a better way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions