mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2025-12-10 02:05:20 +00:00
Instrumtation test fix (#37)
This commit is contained in:
@@ -16,7 +16,7 @@ import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
|
||||
import com.appttude.h_mal.atlas_weather.data.room.Converter
|
||||
import java.io.BufferedReader
|
||||
|
||||
class TestAppClass : AtlasApp() {
|
||||
class TestAppClass : AppClass() {
|
||||
private val idlingResources = CountingIdlingResource("Data_loader")
|
||||
private val mockingNetworkInterceptor = MockingNetworkInterceptor(idlingResources)
|
||||
|
||||
@@ -64,4 +64,15 @@ class TestAppClass : AtlasApp() {
|
||||
locationProvider.addLocationToList(location, lat, long)
|
||||
}
|
||||
|
||||
fun removeLocation(location: String) {
|
||||
locationProvider.removeLocationFromList(location)
|
||||
}
|
||||
|
||||
fun removeLocation(lat: Double, long: Double) {
|
||||
locationProvider.removeLocationFromList(lat, long)
|
||||
}
|
||||
|
||||
fun clearDatabase() {
|
||||
database.getWeatherDao().deleteAll()
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ class SnapshotCaptureTest : BaseTest<MainActivity>(MainActivity::class.java) {
|
||||
super.testFinished()
|
||||
clearLocation("London")
|
||||
clearDatabase()
|
||||
clearPrefs()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
|
||||
<application
|
||||
android:name="com.appttude.h_mal.atlas_weather.application.AtlasApp"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.appttude.h_mal.atlas_weather.application
|
||||
|
||||
import com.appttude.h_mal.atlas_weather.service.notification.NotificationHelper
|
||||
import com.appttude.h_mal.atlas_weather.service.notification.NotificationService
|
||||
import org.kodein.di.generic.bind
|
||||
import org.kodein.di.generic.instance
|
||||
import org.kodein.di.generic.provider
|
||||
import org.kodein.di.generic.singleton
|
||||
|
||||
|
||||
open class AtlasApp : AppClass() {
|
||||
|
||||
private lateinit var notificationService: NotificationService
|
||||
|
||||
override val flavourModule = super.flavourModule.copy {
|
||||
bind() from singleton {
|
||||
NotificationHelper(
|
||||
instance(),
|
||||
instance(),
|
||||
)
|
||||
}
|
||||
|
||||
bind() from singleton {
|
||||
NotificationService(this@AtlasApp).apply { notificationService = this }
|
||||
}
|
||||
|
||||
bind() from provider {
|
||||
ApplicationViewModelFactory(
|
||||
this@AtlasApp,
|
||||
instance(),
|
||||
instance(),
|
||||
instance(),
|
||||
instance()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// override fun onCreate() {
|
||||
// super.onCreate()
|
||||
// notificationService.schedulePushNotifications()
|
||||
// }
|
||||
|
||||
fun scheduleNotifications() = notificationService.schedulePushNotifications()
|
||||
|
||||
fun unscheduleNotifications() = notificationService.unschedulePushNotifications()
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:name="com.appttude.h_mal.atlas_weather.application.AppClass"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:ignore="MissingApplicationIcon" />
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:name="com.appttude.h_mal.atlas_weather.application.MonoApp"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.appttude.h_mal.atlas_weather.application
|
||||
|
||||
import org.kodein.di.generic.bind
|
||||
import org.kodein.di.generic.instance
|
||||
import org.kodein.di.generic.provider
|
||||
|
||||
open class MonoApp : AppClass() {
|
||||
|
||||
override val flavourModule = super.flavourModule.copy {
|
||||
bind() from provider {
|
||||
ApplicationViewModelFactory(
|
||||
this@MonoApp,
|
||||
instance(),
|
||||
instance(),
|
||||
instance(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user