Skip to content

Commit

Permalink
fix: unit test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-arshad-dev committed Jul 8, 2024
1 parent f2cc82e commit b5d79c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.openedx.core.domain.model.CourseDatesCalendarSync
import org.openedx.core.domain.model.CourseStructure
import org.openedx.core.domain.model.CoursewareAccess
import org.openedx.core.domain.model.EnrollmentDetails
import org.openedx.core.presentation.global.AppData
import org.openedx.core.system.CalendarManager
import org.openedx.core.system.ResourceManager
import org.openedx.core.system.connection.NetworkConnection
Expand Down Expand Up @@ -71,6 +72,7 @@ class CourseContainerViewModelTest {
private val imageProcessor = mockk<ImageProcessor>()
private val courseRouter = mockk<CourseRouter>()
private val courseApi = mockk<CourseApi>()
private val appData = mockk<AppData>()

private val openEdx = "OpenEdx"
private val calendarTitle = "OpenEdx - Abc"
Expand Down Expand Up @@ -175,7 +177,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -211,7 +213,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -247,7 +249,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -282,7 +284,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -320,7 +322,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -353,7 +355,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down Expand Up @@ -386,7 +388,7 @@ class CourseContainerViewModelTest {
"",
"",
"",
versionName = "",
appData,
config,
interactor,
calendarManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.openedx.core.domain.model.DashboardCourseList
import org.openedx.core.domain.model.IAPConfig
import org.openedx.core.domain.model.Pagination
import org.openedx.core.presentation.IAPAnalytics
import org.openedx.core.presentation.global.AppData
import org.openedx.core.system.ResourceManager
import org.openedx.core.system.connection.NetworkConnection
import org.openedx.core.system.notifier.AppUpgradeNotifier
Expand Down Expand Up @@ -64,6 +65,7 @@ class DashboardViewModelTest {
private val iapAnalytics = mockk<IAPAnalytics>()
private val appUpgradeNotifier = mockk<AppUpgradeNotifier>()
private val corePreferences = mockk<CorePreferences>()
private val appData = mockk<AppData>()

private val noInternet = "Slow or no internet connection"
private val somethingWrong = "Something went wrong"
Expand Down Expand Up @@ -103,7 +105,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -134,7 +136,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -166,7 +168,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -198,7 +200,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -240,7 +242,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig.iapConfig } returns appConfig.iapConfig

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -270,7 +272,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig
coEvery { interactor.getEnrolledCourses(any()) } returns dashboardCourseList
val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -304,7 +306,7 @@ class DashboardViewModelTest {
every { corePreferences.appConfig } returns appConfig
coEvery { interactor.getEnrolledCourses(any()) } returns dashboardCourseList
val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -342,7 +344,7 @@ class DashboardViewModelTest {
coEvery { iapNotifier.send(any<CourseDataUpdated>()) } returns Unit

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -386,7 +388,7 @@ class DashboardViewModelTest {
coEvery { iapNotifier.send(any<CourseDataUpdated>()) } returns Unit

val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down Expand Up @@ -419,7 +421,7 @@ class DashboardViewModelTest {
coEvery { iapNotifier.notifier } returns flow { emit(CourseDataUpdated()) }
every { corePreferences.appConfig } returns appConfig
val viewModel = DashboardListViewModel(
"",
appData,
config,
networkConnection,
interactor,
Expand Down

0 comments on commit b5d79c2

Please sign in to comment.