Skip to content

Commit

Permalink
fix: remove unnecessary test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
omerhabib26 committed Aug 1, 2024
1 parent c34a466 commit d2dded0
Showing 1 changed file with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,51 +239,6 @@ class CourseContainerViewModelTest {
Dispatchers.resetMain()
}

@Test
fun `getCourseEnrollmentDetails internet connection exception`() = runTest {
val viewModel = CourseContainerViewModel(
"",
"",
"",
appData,
config,
interactor,
calendarManager,
resourceManager,
courseNotifier,
iapNotifier,
networkConnection,
corePreferences,
coursePreferences,
analytics,
imageProcessor,
courseRouter
)
every { networkConnection.isOnline() } returns true
coEvery { interactor.getEnrollmentDetails(any()) } throws UnknownHostException()
every {
analytics.logScreenEvent(
CourseAnalyticsEvent.DASHBOARD.eventName,
any()
)
} returns Unit
viewModel.fetchCourseDetails()
advanceUntilIdle()

coVerify(exactly = 1) { interactor.getEnrollmentDetails(any()) }
verify(exactly = 1) {
analytics.logScreenEvent(
CourseAnalyticsEvent.DASHBOARD.eventName,
any()
)
}

val message = viewModel.errorMessage.value
assertEquals(noInternet, message)
assert(!viewModel.refreshing.value)
assert(viewModel.courseAccessStatus.value == null)
}

@Test
fun `getCourseEnrollmentDetails unknown exception`() = runTest {
val viewModel = CourseContainerViewModel(
Expand Down Expand Up @@ -412,38 +367,6 @@ class CourseContainerViewModelTest {
assert(viewModel.courseAccessStatus.value != null)
}

@Test
fun `updateData no internet connection exception`() = runTest {
val viewModel = CourseContainerViewModel(
"",
"",
"",
appData,
config,
interactor,
calendarManager,
resourceManager,
courseNotifier,
iapNotifier,
networkConnection,
corePreferences,
coursePreferences,
analytics,
imageProcessor,
courseRouter
)
coEvery { interactor.getCourseStructure(any(), true) } throws UnknownHostException()
coEvery { courseNotifier.send(CourseStructureUpdated("")) } returns Unit
viewModel.updateData()
advanceUntilIdle()

coVerify(exactly = 1) { interactor.getCourseStructure(any(), true) }

val message = viewModel.errorMessage.value
assertEquals(noInternet, message)
assert(!viewModel.refreshing.value)
}

@Test
fun `updateData unknown exception`() = runTest {
val viewModel = CourseContainerViewModel(
Expand Down

0 comments on commit d2dded0

Please sign in to comment.