@@ -9,8 +9,6 @@ package io.element.android.libraries.push.impl.push
9
9
10
10
import app.cash.turbine.test
11
11
import com.google.common.truth.Truth.assertThat
12
- import io.element.android.libraries.featureflag.api.FeatureFlags
13
- import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
14
12
import io.element.android.libraries.matrix.api.MatrixClient
15
13
import io.element.android.libraries.matrix.api.sync.SyncState
16
14
import io.element.android.libraries.matrix.test.A_ROOM_ID
@@ -23,7 +21,6 @@ import io.element.android.libraries.matrix.test.sync.FakeSyncService
23
21
import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableCallEvent
24
22
import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent
25
23
import io.element.android.services.appnavstate.test.FakeAppForegroundStateService
26
- import io.element.android.tests.testutils.lambda.assert
27
24
import io.element.android.tests.testutils.lambda.lambdaRecorder
28
25
import io.element.android.tests.testutils.testCoroutineDispatchers
29
26
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -60,24 +57,13 @@ class SyncOnNotifiableEventTest {
60
57
private val notifiableEvent = aNotifiableMessageEvent()
61
58
private val incomingCallNotifiableEvent = aNotifiableCallEvent()
62
59
63
- @Test
64
- fun `when feature flag is disabled, nothing happens` () = runTest {
65
- val sut = createSyncOnNotifiableEvent(client = client, isSyncOnPushEnabled = false )
66
-
67
- sut(listOf (notifiableEvent))
68
-
69
- assert (startSyncLambda).isNeverCalled()
70
- assert (stopSyncLambda).isNeverCalled()
71
- assert (subscribeToSyncLambda).isNeverCalled()
72
- }
73
-
74
60
@OptIn(ExperimentalCoroutinesApi ::class )
75
61
@Test
76
62
fun `when feature flag is enabled, a ringing call waits until the room is in 'in-call' state` () = runTest {
77
63
val appForegroundStateService = FakeAppForegroundStateService (
78
64
initialForegroundValue = false ,
79
65
)
80
- val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true )
66
+ val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
81
67
82
68
val unlocked = AtomicBoolean (false )
83
69
launch {
@@ -97,7 +83,7 @@ class SyncOnNotifiableEventTest {
97
83
val appForegroundStateService = FakeAppForegroundStateService (
98
84
initialForegroundValue = false ,
99
85
)
100
- val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true )
86
+ val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
101
87
102
88
val unlocked = AtomicBoolean (false )
103
89
launch {
@@ -116,7 +102,7 @@ class SyncOnNotifiableEventTest {
116
102
val appForegroundStateService = FakeAppForegroundStateService (
117
103
initialForegroundValue = false ,
118
104
)
119
- val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true )
105
+ val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
120
106
121
107
appForegroundStateService.isSyncingNotificationEvent.test {
122
108
syncService.emitSyncState(SyncState .Running )
@@ -138,7 +124,7 @@ class SyncOnNotifiableEventTest {
138
124
val appForegroundStateService = FakeAppForegroundStateService (
139
125
initialForegroundValue = false ,
140
126
)
141
- val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService, isSyncOnPushEnabled = true )
127
+ val sut = createSyncOnNotifiableEvent(client = client, appForegroundStateService = appForegroundStateService)
142
128
143
129
appForegroundStateService.isSyncingNotificationEvent.test {
144
130
launch { sut(listOf (notifiableEvent)) }
@@ -157,20 +143,13 @@ class SyncOnNotifiableEventTest {
157
143
158
144
private fun TestScope.createSyncOnNotifiableEvent (
159
145
client : MatrixClient = FakeMatrixClient (),
160
- isSyncOnPushEnabled : Boolean = true,
161
146
appForegroundStateService : FakeAppForegroundStateService = FakeAppForegroundStateService (
162
147
initialForegroundValue = true,
163
148
),
164
149
): SyncOnNotifiableEvent {
165
- val featureFlagService = FakeFeatureFlagService (
166
- initialState = mapOf (
167
- FeatureFlags .SyncOnPush .key to isSyncOnPushEnabled
168
- )
169
- )
170
150
val matrixClientProvider = FakeMatrixClientProvider { Result .success(client) }
171
151
return SyncOnNotifiableEvent (
172
152
matrixClientProvider = matrixClientProvider,
173
- featureFlagService = featureFlagService,
174
153
appForegroundStateService = appForegroundStateService,
175
154
dispatchers = testCoroutineDispatchers(),
176
155
)
0 commit comments