Skip to content

Comments

Clean up test suite: remove obsolete code and fix inaccurate tests#355

Merged
hossain-khan merged 3 commits intomainfrom
copilot/check-test-correctness
Nov 19, 2025
Merged

Clean up test suite: remove obsolete code and fix inaccurate tests#355
hossain-khan merged 3 commits intomainfrom
copilot/check-test-correctness

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Review found tests with commented code, unused variables, and misleading names/comments.

Changes

Removed obsolete code (23 lines)

  • Deleted 16 lines of commented-out Firebase initialization in ObserveDeviceHealthWorkerTest
  • Removed unused testDispatcher and testScope variables from AppPreferencesDataStoreTest and EmailQuotaManagerTest
  • Deleted template file ExampleUnitTest.kt

Fixed test accuracy

  • Renamed quota resets on new daygetRemainingQuota returns 0 when quota is exhausted in EmailQuotaManagerTest
  • Test wasn't actually testing day resets, now name matches implementation

Improved documentation

  • Updated @Ignore annotations with specific reasons: "Test has incomplete mock setup - repository.insertAlertCheckLog needs proper mocking"

Example

Before:

@Ignore("Breakpoint is not working to debug the test.")
@Test
fun `doWork logs battery check but doesn't notify when threshold not met`()

After:

@Ignore("Test has incomplete mock setup - repository.insertAlertCheckLog needs proper mocking")
@Test
fun `doWork logs battery check but doesn't notify when threshold not met`()

Result: 135 tests (133 passing, 2 properly ignored), -57 lines of unused code

Original prompt

This section details on the original issue you should resolve

<issue_title>Check test correctness</issue_title>
<issue_description>Double check correctness of all test and ensure it follows best practices with minimal duplicated code.

Also ensure all inline comments reflect actual code or implementation.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 19, 2025 00:46
- Remove commented-out Firebase initialization code from ObserveDeviceHealthWorkerTest
- Update @ignore annotations with clear explanations of why tests are disabled
- Remove unused test variables (testDispatcher, testScope) from DataStore tests
- Remove unused imports
- Fix inaccurate test name and comments in EmailQuotaManagerTest

Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com>
The ExampleUnitTest.kt is a template file with no real test value.

Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com>
Copilot AI changed the title [WIP] Check test correctness and reduce duplication Clean up test suite: remove obsolete code and fix inaccurate tests Nov 19, 2025
Copilot AI requested a review from hossain-khan November 19, 2025 01:01
@hossain-khan hossain-khan marked this pull request as ready for review November 19, 2025 01:03
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Code Coverage Report

View Coverage Report

@hossain-khan hossain-khan merged commit c7049bb into main Nov 19, 2025
8 checks passed
@hossain-khan hossain-khan deleted the copilot/check-test-correctness branch November 19, 2025 01:14
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.

Check test correctness

2 participants