|
| 1 | +/* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | + * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | + |
| 5 | +package mozilla.components.feature.summarize |
| 6 | + |
| 7 | +import kotlinx.coroutines.flow.toList |
| 8 | +import kotlinx.coroutines.launch |
| 9 | +import kotlinx.coroutines.test.runTest |
| 10 | +import mozilla.components.feature.summarize.SummarizationState.Finished |
| 11 | +import mozilla.components.feature.summarize.SummarizationState.Inert |
| 12 | +import mozilla.components.feature.summarize.SummarizationState.ShakeConsentRequired |
| 13 | +import mozilla.components.feature.summarize.SummarizationState.Summarized |
| 14 | +import mozilla.components.feature.summarize.SummarizationState.Summarizing |
| 15 | +import mozilla.components.feature.summarize.fakes.FakeCloudProvider |
| 16 | +import mozilla.components.feature.summarize.fakes.FakeLlm |
| 17 | +import mozilla.components.support.test.fakes.android.FakeSharedPreferences |
| 18 | +import org.junit.Assert.assertEquals |
| 19 | +import org.junit.Assert.assertFalse |
| 20 | +import org.junit.Assert.assertTrue |
| 21 | +import org.junit.Test |
| 22 | +import kotlin.time.Duration.Companion.seconds |
| 23 | + |
| 24 | +class SummarizationSettingsTest { |
| 25 | + |
| 26 | + @Test |
| 27 | + fun `test that we can set and retrieve that the user has consented to shake`() = runTest { |
| 28 | + val prefs = FakeSharedPreferences() |
| 29 | + val settings = SharedPrefsBackedSummarizationSettings(prefs) |
| 30 | + |
| 31 | + assertFalse(settings.getHasConsentedToShake()) |
| 32 | + |
| 33 | + settings.setHasConsentedToShake(true) |
| 34 | + |
| 35 | + assertTrue(settings.getHasConsentedToShake()) |
| 36 | + } |
| 37 | +} |
0 commit comments