Skip to content

Commit

Permalink
GT-2200 Update Test Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gyasistory committed Nov 4, 2024
1 parent 2686d6d commit 2a22a56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.cru.godtools.account

import android.content.Context
import app.cash.turbine.test
import io.mockk.Called
import io.mockk.coEvery
Expand Down Expand Up @@ -48,16 +49,19 @@ class GodToolsAccountManagerTest {
}
private val testScope = TestScope()
private val userApi: UserApi = mockk()
private val context: Context = mockk()

private val manager = GodToolsAccountManager(
providers = listOf(provider1, provider2),
userApi = { userApi },
context = context ,
coroutineScope = testScope.backgroundScope,
)

@Test
fun verifyInjectedProvidersSorted() {
val manager = GodToolsAccountManager(providers = setOf(provider2, provider1), userApi = { userApi })
val manager =
GodToolsAccountManager(providers = setOf(provider2, provider1), userApi = { userApi }, context = context)
assertEquals(listOf(provider1, provider2), manager.providers)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class LoginResponseTest {
assertEquals(LoginResponse.Error.UserAlreadyExists, readParcelable(data))
}

@Test
fun `LoginResponse - Error - NotConnected - Parcelable`() {
val data = writeParcelable(LoginResponse.Error.NotConnected)
assertEquals(LoginResponse.Error.NotConnected, readParcelable(data))
}

private fun writeParcelable(obj: Parcelable) = Parcel.obtain()
.apply { writeParcelable(obj, 0) }
.marshall()
Expand Down

0 comments on commit 2a22a56

Please sign in to comment.