test(common): can 테스트 helper를 추가한다

This commit is contained in:
2026-09-15 11:45:51 +09:00
parent 4bc725bdf2
commit 9bb0a6512e
@@ -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()