From 3e8d522aa8f5c3bef96f84559c32ba8a08b3b0d1 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Mon, 30 Sep 2024 08:42:40 +0200 Subject: [PATCH 1/2] Initialize DataStore with `TestScope.backgroundScope` in unit tests Fixes #1647 --- .../core/data/repository/OfflineFirstNewsRepositoryTest.kt | 2 +- .../core/data/repository/OfflineFirstTopicsRepositoryTest.kt | 2 +- .../core/data/repository/OfflineFirstUserDataRepositoryTest.kt | 2 +- .../nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt index 47c3996c44..413147f0e3 100644 --- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt +++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt @@ -73,7 +73,7 @@ class OfflineFirstNewsRepositoryTest { @Before fun setup() { niaPreferencesDataSource = NiaPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore(testScope), + tmpFolder.testUserPreferencesDataStore(testScope.backgroundScope), ) newsResourceDao = TestNewsResourceDao() topicDao = TestTopicDao() diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt index 3bd314eae5..be41c86f21 100644 --- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt +++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt @@ -60,7 +60,7 @@ class OfflineFirstTopicsRepositoryTest { topicDao = TestTopicDao() network = TestNiaNetworkDataSource() niaPreferences = NiaPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore(testScope), + tmpFolder.testUserPreferencesDataStore(testScope.backgroundScope), ) synchronizer = TestSynchronizer(niaPreferences) diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt index 422e2cfb7e..88b3251e51 100644 --- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt +++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt @@ -51,7 +51,7 @@ class OfflineFirstUserDataRepositoryTest { @Before fun setup() { niaPreferencesDataSource = NiaPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore(testScope), + tmpFolder.testUserPreferencesDataStore(testScope.backgroundScope), ) subject = OfflineFirstUserDataRepository( diff --git a/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt b/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt index 433812808f..ba1706461d 100644 --- a/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt +++ b/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt @@ -40,7 +40,7 @@ class NiaPreferencesDataSourceTest { @Before fun setup() { subject = NiaPreferencesDataSource( - tmpFolder.testUserPreferencesDataStore(testScope), + tmpFolder.testUserPreferencesDataStore(testScope.backgroundScope), ) } From 96f850f2432cc0e579dc12d0f4b77a28bd06540e Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Mon, 30 Sep 2024 15:38:29 +0200 Subject: [PATCH 2/2] Fix prodRelease-badging.txt --- app/prodRelease-badging.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/prodRelease-badging.txt b/app/prodRelease-badging.txt index 21b36a7fbc..9908e775a3 100644 --- a/app/prodRelease-badging.txt +++ b/app/prodRelease-badging.txt @@ -105,9 +105,9 @@ application-icon-640:'res/mipmap-anydpi-v26/ic_launcher.xml' application-icon-65534:'res/mipmap-anydpi-v26/ic_launcher.xml' application: label='Now in Android' icon='res/mipmap-anydpi-v26/ic_launcher.xml' launchable-activity: name='com.google.samples.apps.nowinandroid.MainActivity' label='' icon='' +uses-library-not-required:'android.ext.adservices' uses-library-not-required:'androidx.window.extensions' uses-library-not-required:'androidx.window.sidecar' -uses-library-not-required:'android.ext.adservices' feature-group: label='' uses-feature: name='android.hardware.faketouch' uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'