Change signature of getCurrentDistributor.
This commit is contained in:
parent
500659d4e1
commit
f0aca004ba
9 changed files with 13 additions and 16 deletions
|
|
@ -41,8 +41,8 @@ class UnifiedPushProvider @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun getCurrentDistributor(matrixClient: MatrixClient): Distributor? {
|
||||
val distributorValue = unifiedPushStore.getDistributorValue(matrixClient.sessionId)
|
||||
override suspend fun getCurrentDistributor(sessionId: SessionId): Distributor? {
|
||||
val distributorValue = unifiedPushStore.getDistributorValue(sessionId)
|
||||
return getDistributors().find { it.value == distributorValue }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ class UnifiedPushProviderTest {
|
|||
@Test
|
||||
fun `getCurrentDistributor ok`() = runTest {
|
||||
val distributor = Distributor("value", "Name")
|
||||
val matrixClient = FakeMatrixClient()
|
||||
val unifiedPushProvider = createUnifiedPushProvider(
|
||||
unifiedPushStore = FakeUnifiedPushStore(
|
||||
getDistributorValueResult = { distributor.value }
|
||||
|
|
@ -174,14 +173,13 @@ class UnifiedPushProviderTest {
|
|||
)
|
||||
)
|
||||
)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(matrixClient)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(A_SESSION_ID)
|
||||
assertThat(result).isEqualTo(distributor)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getCurrentDistributor not know`() = runTest {
|
||||
val distributor = Distributor("value", "Name")
|
||||
val matrixClient = FakeMatrixClient()
|
||||
val unifiedPushProvider = createUnifiedPushProvider(
|
||||
unifiedPushStore = FakeUnifiedPushStore(
|
||||
getDistributorValueResult = { "unknown" }
|
||||
|
|
@ -192,14 +190,13 @@ class UnifiedPushProviderTest {
|
|||
)
|
||||
)
|
||||
)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(matrixClient)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(A_SESSION_ID)
|
||||
assertThat(result).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getCurrentDistributor not found`() = runTest {
|
||||
val distributor = Distributor("value", "Name")
|
||||
val matrixClient = FakeMatrixClient()
|
||||
val unifiedPushProvider = createUnifiedPushProvider(
|
||||
unifiedPushStore = FakeUnifiedPushStore(
|
||||
getDistributorValueResult = { distributor.value }
|
||||
|
|
@ -208,7 +205,7 @@ class UnifiedPushProviderTest {
|
|||
getDistributorsResult = emptyList()
|
||||
)
|
||||
)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(matrixClient)
|
||||
val result = unifiedPushProvider.getCurrentDistributor(A_SESSION_ID)
|
||||
assertThat(result).isNull()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue