This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
format-common-impl/src/test/kotlin/app/passwordstore/data/passfile Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 55
66package app.passwordstore.data.passfile
77
8+ import app.cash.turbine.Event
89import app.cash.turbine.test
910import app.passwordstore.test.CoroutineTestRule
1011import app.passwordstore.util.time.TestUserClock
@@ -19,6 +20,7 @@ import kotlin.test.assertTrue
1920import kotlin.time.Duration.Companion.seconds
2021import kotlin.time.ExperimentalTime
2122import kotlinx.coroutines.ExperimentalCoroutinesApi
23+ import kotlinx.coroutines.delay
2224import kotlinx.coroutines.test.runTest
2325import org.junit.Rule
2426import org.junit.runner.RunWith
@@ -177,6 +179,17 @@ class PasswordEntryTest {
177179 }
178180 }
179181
182+ @Test
183+ fun emitsTotpEverySecond () = runTest {
184+ val entry = makeEntry(TOTP_URI )
185+ entry.totp.test {
186+ delay(3000L )
187+ val events = cancelAndConsumeRemainingEvents()
188+ assertEquals(3 , events.size)
189+ assertTrue { events.all { event -> event is Event .Item <Totp > } }
190+ }
191+ }
192+
180193 @Test
181194 fun onlyLooksForUriInFirstLine () {
182195 val entry = makeEntry(" id:\n $TOTP_URI " )
You can’t perform that action at this time.
0 commit comments