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 5
5
6
6
package app.passwordstore.data.passfile
7
7
8
+ import app.cash.turbine.Event
8
9
import app.cash.turbine.test
9
10
import app.passwordstore.test.CoroutineTestRule
10
11
import app.passwordstore.util.time.TestUserClock
@@ -19,6 +20,7 @@ import kotlin.test.assertTrue
19
20
import kotlin.time.Duration.Companion.seconds
20
21
import kotlin.time.ExperimentalTime
21
22
import kotlinx.coroutines.ExperimentalCoroutinesApi
23
+ import kotlinx.coroutines.delay
22
24
import kotlinx.coroutines.test.runTest
23
25
import org.junit.Rule
24
26
import org.junit.runner.RunWith
@@ -177,6 +179,17 @@ class PasswordEntryTest {
177
179
}
178
180
}
179
181
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
+
180
193
@Test
181
194
fun onlyLooksForUriInFirstLine () {
182
195
val entry = makeEntry(" id:\n $TOTP_URI " )
You can’t perform that action at this time.
0 commit comments