Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b243fe5f authored by Alejandro Nijamkin's avatar Alejandro Nijamkin Committed by Ale Nijamkin
Browse files

[flexiglass] Fixes failing test after coroutine lib upgrade.

The changed test case started failing after the coroutines library has
been upgraded; not sure why.

This fixes it by toggling the isUnlocked state to trigger the flow under
test to update (since updating getAuthenticationMethod() or
isLockscreenEnabled does not trigger this flow to update).

Bug: 292807808
Test: N/A
Change-Id: Ie26c407931e52a98235c575adf9ba12186caa3a2
Merged-In: Ie26c407931e52a98235c575adf9ba12186caa3a2
(cherry picked from commit cd267675)
parent ac801875
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,22 @@ class AuthenticationInteractorTest : SysuiTestCase() {
            utils.authenticationRepository.setLockscreenEnabled(false)
            utils.authenticationRepository.setLockscreenEnabled(false)


            val isUnlocked by collectLastValue(underTest.isUnlocked)
            val isUnlocked by collectLastValue(underTest.isUnlocked)
            // Toggle isUnlocked, twice.
            //
            // This is done because the underTest.isUnlocked flow doesn't receive values from
            // just changing the state above; the actual isUnlocked state needs to change to
            // cause the logic under test to "pick up" the current state again.
            //
            // It is done twice to make sure that we don't actually change the isUnlocked
            // state from what it originally was.
            utils.authenticationRepository.setUnlocked(
                !utils.authenticationRepository.isUnlocked.value
            )
            runCurrent()
            utils.authenticationRepository.setUnlocked(
                !utils.authenticationRepository.isUnlocked.value
            )
            runCurrent()
            assertThat(isUnlocked).isTrue()
            assertThat(isUnlocked).isTrue()
        }
        }