Skip to content

Commit

Permalink
fix(applock): team app lock dialog displayed when changing timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine committed Nov 16, 2023
1 parent 8fe2fc7 commit 1912685
Showing 1 changed file with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AppLockConfigHandlerTest {
}

@Test
fun givenNewStatusSameAsCurrent_whenHandlingTheEvent_ThenSetAppLockWithStatusChangedFalse() {
fun givenNewStatusSameAsCurrent_whenHandlingTheEvent_ThenSetAppLockWithOldStatusChangedValue() {
val appLockModel = AppLockModel(Status.ENABLED, 44)
val (arrangement, appLockConfigHandler) = Arrangement()
.withAppLocked()
Expand All @@ -99,30 +99,7 @@ class AppLockConfigHandlerTest {
.with(
eq(appLockModel.status.toBoolean()),
eq(appLockModel.inactivityTimeoutSecs),
eq(false)
)
.wasInvoked(exactly = once)
}

@Test
fun givenStatusEnabledAndTimeoutDifferentFromCurrent_whenHandlingTheEvent_ThenSetAppLockWithStatusChangedTrue() {
val appLockModel = AppLockModel(Status.ENABLED, 20)
val (arrangement, appLockConfigHandler) = Arrangement()
.withAppLocked()
.arrange()

appLockConfigHandler.handle(appLockModel)

verify(arrangement.userConfigRepository)
.function(arrangement.userConfigRepository::isTeamAppLockEnabled)
.wasInvoked(exactly = once)

verify(arrangement.userConfigRepository)
.function(arrangement.userConfigRepository::setAppLockStatus)
.with(
eq(appLockModel.status.toBoolean()),
eq(appLockModel.inactivityTimeoutSecs),
eq(true)
eq(appLockTeamConfigEnabled.isStatusChanged)
)
.wasInvoked(exactly = once)
}
Expand Down

0 comments on commit 1912685

Please sign in to comment.