FakeUserPreferencesDataSource

In-memory UserPreferencesDataSource for tests.

A fake rather than a mock: it holds real state in a MutableStateFlow, so a test can write through the interface and then assert on what a collector observes. That is the behaviour that matters for a DataStore-backed source, and mocks cannot express it.

Parameters

initial

The state to start from.

Constructors

Link copied to clipboard
constructor(initial: UserDataPreferences = UserDataPreferences())

Properties

Link copied to clipboard

The current value, for assertions that do not need to collect the flow.

Functions

Link copied to clipboard
open override fun getUserDataPreferences(): Flow<UserDataPreferences>
Link copied to clipboard
open suspend override fun getUserIdOrThrow(): String
Link copied to clipboard
open suspend override fun resetUserPreferences()
Link copied to clipboard
open suspend override fun setDarkThemeConfig(darkThemeConfigPreferences: DarkThemeConfigPreferences)
Link copied to clipboard
open suspend override fun setDynamicColorPreference(useDynamicColor: Boolean)
Link copied to clipboard
open suspend override fun setUserProfile(preferencesUserProfile: PreferencesUserProfile)