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

Verified Commit 5c7cf4ca authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

test(InstallStatusStream): fix mock to emit multiple values

Use returnsMany instead of returns for getInstalledPwaUrls() and add
runCurrent() call to properly handle flow emissions in the test.
parent b6616bc9
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -81,7 +81,10 @@ class InstallStatusStreamTest {
            listOf(appInfo("com.example.one")),
            listOf(appInfo("com.example.two")),
        )
        every { pwaManager.getInstalledPwaUrls() } returns setOf("https://pwa.example")
        every { pwaManager.getInstalledPwaUrls() } returnsMany listOf(
            setOf("https://pwa.example"),
            setOf("https://pwa.example"),
        )

        val stream = InstallStatusStream(appManager, appLoungePackageManager, pwaManager)
        val collectedSnapshots = backgroundScope.async {
@@ -90,6 +93,8 @@ class InstallStatusStreamTest {
                .toList()
        }

        runCurrent()
        advanceTimeBy(50)
        runCurrent()
        advanceTimeBy(50)
        runCurrent()