Hello, I have a lot of unit tests that relies on t...
# multiplatform
e
Hello, I have a lot of unit tests that relies on the real string values to do some checks. These tests are android instrumented tests, and i am using Robolectric. I am having a problem while calling the compose multiplatform resources function:
val myString = runBlocking { getString(Res.string.myString) }
The exception i am getting is
Copy code
Android context is not initialized. If it happens in the Preview mode then call PreviewContextConfigurationEffect() function.
Before start using Compose Resources I didn't have such a problem. Anybody with the same problem that discovered how to solve it?
a
some bg, seems like composeResources, needs a content provider for initialising the context and Roboelectric doesn't load the content provider by default so in the Robo test composeResource is asserting the same. There is one hack in the thread to solve this issue for compose test
🙌 1