Skip to content

Conversation

eyhgpt
Copy link
Contributor

@eyhgpt eyhgpt commented Jan 7, 2025

Improve the unit test to perform meaningful comparisons instead of simply comparing two empty lists.

In the unit test function offlineFirstTopicsRepository_topics_stream_is_backed_by_topics_dao()

Both topicDao.getTopicEntities().first().map(TopicEntity::asExternalModel) and subject.getTopics().first() return an empty list. This is because subject.syncWith(synchronizer) is not called beforehand.

This unit test doesn't seem meaningful by just comparing two empty lists.

This PR adds a subject.syncWith(synchronizer) call before retrieving the topic entities, so that lists with actual elements can be compared, to prove that offlineFirstTopicsRepository.getTopics() is based by topicDao.getTopicEntities().

Improve the unit test to do meaning comparisons instead of just comparing two empty lists.
dturner and others added 3 commits January 7, 2025 12:42
…/core/data/repository/OfflineFirstTopicsRepositoryTest.kt
…/core/data/repository/OfflineFirstTopicsRepositoryTest.kt
@dturner dturner merged commit c6588b0 into android:main Jan 7, 2025
5 checks passed
@yrezgui
Copy link
Contributor

yrezgui commented Mar 21, 2025

/gemini summarize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants