Skip to content

Add test for CardBrowserFragmentViewModel.openDeckSelectionDialog - #21434

Open
GuTS805 wants to merge 1 commit into
ankidroid:mainfrom
GuTS805:test/card-browser-fragment-viewmodel-13283
Open

Add test for CardBrowserFragmentViewModel.openDeckSelectionDialog#21434
GuTS805 wants to merge 1 commit into
ankidroid:mainfrom
GuTS805:test/card-browser-fragment-viewmodel-13283

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Covers the default usage: calling openDeckSelectionDialog() emits from flowOfSearchForDecks.
Verified via mutation testing that removing the emit breaks the test.

Fixes part of #13283

Purpose / Description

CardBrowserFragmentViewModel.openDeckSelectionDialog had no test coverage
(@NeedsTest("default usage")). This is another item from the #13283 tracker — only this single
method is covered here, per the maintainer's stated preference to keep PRs to one test at a time.

Approach

Added CardBrowserFragmentViewModelTest using Turbine to verify that calling
openDeckSelectionDialog() causes flowOfSearchForDecks to emit a value.

How Has This Been Tested?

Ran the new test in isolation and confirmed it fails when the emit is removed from
openDeckSelectionDialog() (mutation test: temporarily removed flowOfSearchForDecks.emit(Unit),
confirmed the test failed with a Turbine timeout, then reverted). Also ran the full
com.ichi2.anki.browser.* test package with no regressions.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Covers the default usage: calling openDeckSelectionDialog() emits from flowOfSearchForDecks.
Verified via mutation testing that removing the emit breaks the test.

Fixes part of ankidroid#13283
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Snapshot diff report vs main. Open screenshot-diff for diffs.

  • DeckPickerScreenshotTest: 2 changes
All 2 changed screenshots

DeckPickerScreenshotTest

  • hierarchy_lines_collapsed_compare.png
  • hierarchy_lines_many_siblings_compare.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant