Skip to content

Commit d4c1416

Browse files
committed
fix ignored test
1 parent 77a5767 commit d4c1416

File tree

3 files changed

+20
-73
lines changed

3 files changed

+20
-73
lines changed

vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import kotlinx.coroutines.flow.flowOf
4848
import org.amshove.kluent.shouldBeEqualTo
4949
import org.junit.After
5050
import org.junit.Before
51-
import org.junit.Ignore
5251
import org.junit.Rule
5352
import org.junit.Test
5453
import org.matrix.android.sdk.api.session.crypto.crosssigning.DeviceTrustLevel
@@ -129,34 +128,17 @@ class DevicesViewModelTest {
129128
}
130129

131130
@Test
132-
@Ignore
133131
fun `given the viewModel when initializing it then verification listener is added`() {
134-
// // Given
135-
// val fakeVerificationService = givenVerificationService()
136-
//
137-
// // When
138-
// val viewModel = createViewModel()
139-
//
140-
// // Then
141-
// verify {
142-
// fakeVerificationService.addListener(viewModel)
143-
// }
144-
}
132+
// Given
133+
val fakeVerificationService = givenVerificationService()
145134

146-
@Test
147-
@Ignore
148-
fun `given the viewModel when clearing it then verification listener is removed`() {
149-
// // Given
150-
// val fakeVerificationService = givenVerificationService()
151-
//
152-
// // When
153-
// val viewModel = createViewModel()
154-
// viewModel.onCleared()
155-
//
156-
// // Then
157-
// verify {
158-
// fakeVerificationService.removeListener(viewModel)
159-
// }
135+
// When
136+
createViewModel()
137+
138+
// Then
139+
verify {
140+
fakeVerificationService.requestEventFlow()
141+
}
160142
}
161143

162144
@Test

vector/src/test/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewModelTest.kt

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ import io.mockk.justRun
3838
import io.mockk.mockk
3939
import io.mockk.mockkStatic
4040
import io.mockk.unmockkAll
41+
import io.mockk.verify
4142
import io.mockk.verifyAll
4243
import kotlinx.coroutines.flow.flowOf
4344
import org.amshove.kluent.shouldBeEqualTo
4445
import org.junit.After
4546
import org.junit.Before
46-
import org.junit.Ignore
4747
import org.junit.Rule
4848
import org.junit.Test
4949
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
@@ -108,38 +108,20 @@ class OtherSessionsViewModelTest {
108108
}
109109

110110
@Test
111-
@Ignore
112111
fun `given the viewModel when initializing it then verification listener is added`() {
113112
// Given
114-
// val fakeVerificationService = givenVerificationService()
115-
// val devices = mockk<List<DeviceFullInfo>>()
116-
// givenGetDeviceFullInfoListReturns(filterType = defaultArgs.defaultFilter, devices)
117-
//
118-
// // When
119-
// val viewModel = createViewModel()
113+
val fakeVerificationService = givenVerificationService()
114+
.also { it.givenEventFlow() }
115+
val devices = mockk<List<DeviceFullInfo>>()
116+
givenGetDeviceFullInfoListReturns(filterType = defaultArgs.defaultFilter, devices)
120117

121-
// Then
122-
// verify {
123-
// fakeVerificationService.addListener(viewModel)
124-
// }
125-
}
118+
// When
119+
createViewModel()
126120

127-
@Test
128-
@Ignore
129-
fun `given the viewModel when clearing it then verification listener is removed`() {
130-
// // Given
131-
// val fakeVerificationService = givenVerificationService()
132-
// val devices = mockk<List<DeviceFullInfo>>()
133-
// givenGetDeviceFullInfoListReturns(filterType = defaultArgs.defaultFilter, devices)
134-
//
135-
// // When
136-
// val viewModel = createViewModel()
137-
// viewModel.onCleared()
138-
//
139-
// // Then
140-
// verify {
141-
// fakeVerificationService.removeListener(viewModel)
142-
// }
121+
// Then
122+
verify {
123+
fakeVerificationService.requestEventFlow()
124+
}
143125
}
144126

145127
@Test

vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import kotlinx.coroutines.flow.flowOf
4848
import org.amshove.kluent.shouldBeEqualTo
4949
import org.junit.After
5050
import org.junit.Before
51-
import org.junit.Ignore
5251
import org.junit.Rule
5352
import org.junit.Test
5453
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
@@ -142,22 +141,6 @@ class SessionOverviewViewModelTest {
142141
}
143142
}
144143

145-
@Test
146-
@Ignore
147-
fun `given the viewModel when clearing it then verification listener is removed`() {
148-
// // Given
149-
// val fakeVerificationService = givenVerificationService()
150-
//
151-
// // When
152-
// val viewModel = createViewModel()
153-
// viewModel.onCleared()
154-
//
155-
// // Then
156-
// verify {
157-
// fakeVerificationService.removeListener(viewModel)
158-
// }
159-
}
160-
161144
@Test
162145
fun `given the viewModel has been initialized then pushers are refreshed`() {
163146
createViewModel()

0 commit comments

Comments
 (0)