test: add comprehensive unit tests for :core:datastore module - #1590
Open
fpMiguel wants to merge 4 commits into
Open
test: add comprehensive unit tests for :core:datastore module#1590fpMiguel wants to merge 4 commits into
fpMiguel wants to merge 4 commits into
Conversation
Futsch1
approved these changes
Jul 21, 2026
Owner
There was a problem hiding this comment.
@fpMiguel
Thank you for your contribution! Your PR is still draft, so I cannot merge it yet. I will look into all of your PRs and review them. Once they are all approved and good to merge, I will do this all in one go to come to a working state of tests again.
Oh, and it would be great to disclose if you used AI to generate the PRs.
Futsch1
requested changes
Jul 21, 2026
141 JVM unit tests across 3 test classes covering: - PreferencesDataSourceTest: default values, roundtrips, enum parsing, flow emission, PreferenceDataStore overrides - PersistentDataDataSourceTest: defaults, setters, notification ID, pending snooze CRUD, StatisticFragment mapping, data flow - BackupMapperTest: toSettingsBackup mapping, applyTo roundtrip 134 pass, 7 intentionally fail documenting production code bugs. Also removes duplicated datastore tests from :app module and uses version catalog for androidx.test:core dependency.
The bugs they documented were fixed in the merged PreferencesDataSource and PersistentDataDataSource PRs; the tests now pass and the comments were stale.
fpMiguel
force-pushed
the
datastore-unit-tests
branch
from
August 8, 2026 20:03
fc450d1 to
77b395d
Compare
fpMiguel
marked this pull request as ready for review
August 10, 2026 19:49
Futsch1
reviewed
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 92 JVM unit tests to
:core:datastore— the module previously had no directtests. Covers
PreferencesDataSource(32),PersistentDataDataSource(48) andBackupMapper(12) with edge-case coverage, and moves the existing datastore testsfrom
:appinto the module where the code under test lives.Changes
core/datastore/build.gradle.ktsgradle/libs.versions.tomlandroidx.test:coreto the version catalogcore/datastore/src/test/.../BackupMapperTest.kttoSettingsBackupmapping +applyTointegrationcore/datastore/src/test/.../PreferencesDataSourceTest.ktcore/datastore/src/test/.../PersistentDataDataSourceTest.ktapp/src/test/.../location/(deleted):core:datastorewhere the code under test livesNotes
SharedPreferencesbehavior were removed