is there way to mock composable functions calls? For example mock
Copy code
isSystemInDarkTheme()
result
g
gildor
05/19/2021, 6:32 AM
What is your use case? For UI tests?
i
iamthevoid
05/19/2021, 6:33 AM
Yep, i want to check behavior of elements depends on system day-night theme
iamthevoid
05/19/2021, 6:39 AM
Is it possible anyhow?
a
Abhishek Dewan
05/19/2021, 6:49 AM
you could possibly just create a two new theme composables one that is always dark mode and one that is always light mode and use them for testing purposes.
Abhishek Dewan
05/19/2021, 6:50 AM
Essentially writing two testing theme composables which read from your existing light and dark palettes. perhaps there is a better way
g
gildor
05/19/2021, 9:10 AM
If you want to test your composable, do not rely on Ambient, instead explicitly pass param to you composable with display mode
Ambient is really an anti pattern in most of the cases