test(common): can 테스트 helper를 추가한다
This commit is contained in:
@@ -92,6 +92,28 @@ object SharedPreferenceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||||
|
fun resetCanForTest() {
|
||||||
|
ensureInitialized()
|
||||||
|
runBlocking {
|
||||||
|
dataStore.edit { preferences ->
|
||||||
|
removeByName(preferences, Constants.PREF_CAN)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
preferenceState.update { state -> state - Constants.PREF_CAN }
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||||
|
fun setCanForTest(value: Int) {
|
||||||
|
ensureInitialized()
|
||||||
|
runBlocking {
|
||||||
|
dataStore.edit { preferences ->
|
||||||
|
preferences[intPreferencesKey(Constants.PREF_CAN)] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
preferenceState.update { state -> state + (Constants.PREF_CAN to value) }
|
||||||
|
}
|
||||||
|
|
||||||
fun clear() {
|
fun clear() {
|
||||||
ensureInitialized()
|
ensureInitialized()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user