mirror of
https://github.com/bitwarden/android.git
synced 2025-02-23 00:59:16 +03:00
PM-15087: Fix PushManager unit test
The PushService method result was not mocked and tests had wrong assertions.
This commit is contained in:
parent
0ed7521963
commit
eda5374270
1 changed files with 5 additions and 3 deletions
|
@ -51,7 +51,9 @@ class PushManagerTest {
|
|||
|
||||
private val pushDiskSource: PushDiskSource = PushDiskSourceImpl(FakeSharedPreferences())
|
||||
|
||||
private val pushService: PushService = mockk()
|
||||
private val pushService: PushService = mockk {
|
||||
coEvery { putDeviceToken(any()) } returns Unit.asSuccess()
|
||||
}
|
||||
|
||||
private lateinit var pushManager: PushManager
|
||||
|
||||
|
@ -716,7 +718,7 @@ class PushManagerTest {
|
|||
pushService.putDeviceToken(PushTokenRequest(newToken))
|
||||
}
|
||||
assertEquals(
|
||||
lastRegistration.toEpochSecond(),
|
||||
clock.instant().epochSecond,
|
||||
pushDiskSource.getLastPushTokenRegistrationDate(userId)?.toEpochSecond(),
|
||||
)
|
||||
assertEquals(newToken, pushDiskSource.registeredPushToken)
|
||||
|
@ -741,7 +743,7 @@ class PushManagerTest {
|
|||
pushService.putDeviceToken(PushTokenRequest(newToken))
|
||||
}
|
||||
assertEquals(
|
||||
lastRegistration.toEpochSecond(),
|
||||
clock.instant().epochSecond,
|
||||
pushDiskSource.getLastPushTokenRegistrationDate(userId)?.toEpochSecond(),
|
||||
)
|
||||
assertEquals(newToken, pushDiskSource.registeredPushToken)
|
||||
|
|
Loading…
Add table
Reference in a new issue