mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-15 10:46:12 -04:00
23 lines
663 B
Kotlin
23 lines
663 B
Kotlin
package testhelper.preferences
|
|
|
|
import androidx.core.content.edit
|
|
import io.kotest.matchers.shouldBe
|
|
import org.junit.jupiter.api.Test
|
|
import testhelper.BaseTest
|
|
import testhelpers.preferences.MockSharedPreferences
|
|
|
|
class MockSharedPreferencesTest : BaseTest() {
|
|
|
|
private fun createInstance() = MockSharedPreferences()
|
|
|
|
@Test
|
|
fun `test boolean insertion`() {
|
|
val prefs = createInstance()
|
|
prefs.dataMapPeek shouldBe emptyMap()
|
|
prefs.getBoolean("key", true) shouldBe true
|
|
prefs.edit { putBoolean("key", false) }
|
|
prefs.getBoolean("key", true) shouldBe false
|
|
prefs.dataMapPeek["key"] shouldBe false
|
|
}
|
|
}
|