aboutsummaryrefslogtreecommitdiffstats
path: root/format-common/src/test/kotlin/dev/msfjarvis/aps/util
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-03-11 01:52:39 +0530
committerGitHub <noreply@github.com>2022-03-10 20:22:39 +0000
commit2f034bc2372d29b4ddebf74d532279073fb3d92b (patch)
treedc9197276622c56f32c9b395e9339a046f608103 /format-common/src/test/kotlin/dev/msfjarvis/aps/util
parent3e988b2a3428c3759535a2bd1f3e1ba0b5e411a3 (diff)
downloadHardenedPass-2f034bc2372d29b4ddebf74d532279073fb3d92b.tar.gz
HardenedPass-2f034bc2372d29b4ddebf74d532279073fb3d92b.zip
Show remaining time in TOTP field (#1766)
* Pass down remaining time for TOTPs to UI layer * format-common: switch TOTP flow to use co-operative cancelation * format-common: add a regression test for OTP duration calculation * Abstract out labels * Switch to launchIn
Diffstat (limited to 'format-common/src/test/kotlin/dev/msfjarvis/aps/util')
-rw-r--r--format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt
index 5098bec9..ee74a40d 100644
--- a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt
+++ b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt
@@ -24,4 +24,10 @@ class TestUserClock(instant: Instant) : UserClock() {
override fun getZone(): ZoneId = UTC
override fun instant(): Instant = clock.instant()
+
+ companion object {
+ fun withAddedSeconds(secondsToAdd: Long): TestUserClock {
+ return TestUserClock(Instant.EPOCH.plusSeconds(secondsToAdd))
+ }
+ }
}