From b651b2ed4d7d73edccb4e2b484606418adea8fec Mon Sep 17 00:00:00 2001 From: Pirate Cat Date: Tue, 7 Jan 2025 16:38:16 +1100 Subject: [PATCH 1/4] Update OfflineFirstTopicsRepositoryTest.kt Improve the unit test to do meaning comparisons instead of just comparing two empty lists. --- .../core/data/repository/OfflineFirstTopicsRepositoryTest.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 d32f424d89..eb7ebbeecc 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 @@ -67,6 +67,10 @@ class OfflineFirstTopicsRepositoryTest { @Test fun offlineFirstTopicsRepository_topics_stream_is_backed_by_topics_dao() = testScope.runTest { + // After sync, topicDao.getTopicEntities().first() and subject.getTopics().first() + // will return non-empty lists. + subject.syncWith(synchronizer) + assertEquals( topicDao.getTopicEntities() .first() From dfc55c94e3fa7950df0c7d26315d0e7f10bbc4d4 Mon Sep 17 00:00:00 2001 From: Don Turner Date: Tue, 7 Jan 2025 12:42:57 +0000 Subject: [PATCH 2/4] Update core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt --- .../core/data/repository/OfflineFirstTopicsRepositoryTest.kt | 1 - 1 file changed, 1 deletion(-) 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 eb7ebbeecc..1ddf0d0d89 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 @@ -67,7 +67,6 @@ class OfflineFirstTopicsRepositoryTest { @Test fun offlineFirstTopicsRepository_topics_stream_is_backed_by_topics_dao() = testScope.runTest { - // After sync, topicDao.getTopicEntities().first() and subject.getTopics().first() // will return non-empty lists. subject.syncWith(synchronizer) From 793317bfbd8cd18eea0395d8e0ec65da408d8c81 Mon Sep 17 00:00:00 2001 From: Don Turner Date: Tue, 7 Jan 2025 12:43:02 +0000 Subject: [PATCH 3/4] Update core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt --- .../core/data/repository/OfflineFirstTopicsRepositoryTest.kt | 1 - 1 file changed, 1 deletion(-) 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 1ddf0d0d89..81bc28b169 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 @@ -67,7 +67,6 @@ class OfflineFirstTopicsRepositoryTest { @Test fun offlineFirstTopicsRepository_topics_stream_is_backed_by_topics_dao() = testScope.runTest { - // will return non-empty lists. subject.syncWith(synchronizer) assertEquals( From b7973eeac9944da1e692ae91be2f00f9104bd6bd Mon Sep 17 00:00:00 2001 From: Don Turner Date: Tue, 7 Jan 2025 12:48:49 +0000 Subject: [PATCH 4/4] Fix spotless --- .../core/data/repository/OfflineFirstTopicsRepositoryTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 81bc28b169..4050a6a399 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 @@ -68,7 +68,7 @@ class OfflineFirstTopicsRepositoryTest { fun offlineFirstTopicsRepository_topics_stream_is_backed_by_topics_dao() = testScope.runTest { subject.syncWith(synchronizer) - + assertEquals( topicDao.getTopicEntities() .first()