Skip to content

Conversation

kaungkhantsoe
Copy link
Contributor

@kaungkhantsoe kaungkhantsoe commented Mar 11, 2025

#610

  • Update TemplateCompose
  • Update SampleCompose

What happened 👀

Insight 📝

  • Refactored AndroidTest of HomeScreen by following Hilt testing guide
  • We can test HomeScreenTest under test directory as usual without needing an emulator or a real device
    • We can test any UI test of a specific screen in the HomeScreenTest as usual
  • If we want to test navigations, we need to test HomeScreenTest under androidTest and we will need an emulator or a real device

Proof Of Work 📹

CI should pass for all Unit tests

Home screen UI test

ScreenRecording.mp4

Copy link

coderabbitai bot commented Mar 11, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kaungkhantsoe kaungkhantsoe force-pushed the chore/610-part-1-update-navigation-library-and-refactor-to-follow-unidirectional-data-flow branch from 8f23608 to d220269 Compare March 11, 2025 17:17
Copy link

github-actions bot commented Mar 11, 2025

13 Warnings
⚠️ Uh oh! AppDestination.kt is under 95% coverage!
⚠️ Uh oh! AppNavGraph.kt is under 95% coverage!
⚠️ Uh oh! BaseViewModel.kt is under 95% coverage!
⚠️ Uh oh! HomeScreen.kt is under 95% coverage!
⚠️ Uh oh! MainDestination.kt is under 95% coverage!
⚠️ Uh oh! MainNavGraph.kt is under 95% coverage!
⚠️ Uh oh! Your project is under 80% coverage!
⚠️ template-compose/gradle/libs.versions.toml#L10 - A newer version of androidx.compose:compose-bom than 2025.02.00 is available: 2025.04.01
⚠️ template-compose/gradle/libs.versions.toml#L12 - A newer version of androidx.navigation:navigation-compose than 2.5.3 is available: 2.8.9
⚠️ template-compose/gradle/libs.versions.toml#L13 - A newer version of androidx.core:core-ktx than 1.15.0 is available: 1.16.0
⚠️ template-compose/gradle/libs.versions.toml#L14 - A newer version of androidx.datastore:datastore-preferences than 1.1.2 is available: 1.1.5
⚠️ template-compose/gradle/libs.versions.toml#L16 - A newer version of com.android.application than 8.8.1 is available: 8.9.2. (There is also a newer version of 8.8.𝑥 available, if upgrading to 8.9.2 is difficult: 8.8.2)
⚠️ template-compose/gradle/libs.versions.toml#L16 - A newer version of com.android.library than 8.8.1 is available: 8.9.2. (There is also a newer version of 8.8.𝑥 available, if upgrading to 8.9.2 is difficult: 8.8.2)

Kover report for template-compose:

🧛 Template - Compose Unit Tests Code Coverage: 62.12%

Coverage of Modified Files:

File Coverage
AppDestination.kt 75.00%
AppNavGraph.kt 52.35%
BaseViewModel.kt 72.90%
HomeScreen.kt 67.89%
HomeViewModel.kt 100.00%
MainDestination.kt 60.00%
MainNavGraph.kt 37.50%

Modified Files Not Found In Coverage Report:

BaseAppDestination.kt
HiltTestRunner.kt
HomeScreenTest.kt
HomeScreenTest.kt
HomeViewModelTest.kt
Item.kt
ItemList.kt
NavHostControllerExt.kt
NavigationExt.kt
SecondScreen.kt
ThirdScreen.kt
build.gradle.kts
libs.versions.toml

Codebase cunningly covered by count Shroud 🧛

Generated by 🚫 Danger

@kaungkhantsoe kaungkhantsoe temporarily deployed to template-compose May 2, 2025 10:47 — with GitHub Actions Inactive
@kaungkhantsoe kaungkhantsoe marked this pull request as ready for review May 2, 2025 10:57
@kaungkhantsoe kaungkhantsoe temporarily deployed to template-compose May 2, 2025 10:58 — with GitHub Actions Inactive
@kaungkhantsoe kaungkhantsoe force-pushed the chore/610-part-1-update-navigation-library-and-refactor-to-follow-unidirectional-data-flow branch from d220269 to b3efc02 Compare May 2, 2025 11:22
@kaungkhantsoe kaungkhantsoe force-pushed the chore/610-part-1-update-navigation-library-and-refactor-to-follow-unidirectional-data-flow branch from b3efc02 to b651f17 Compare May 2, 2025 11:25
@kaungkhantsoe kaungkhantsoe temporarily deployed to template-compose May 2, 2025 11:25 — with GitHub Actions Inactive
@ryan-conway ryan-conway requested review from Copilot and removed request for chornerman June 6, 2025 02:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the navigation library and refactors the app’s navigation approach by exposing event callbacks instead of using internal navigator flows. Key changes include refactoring HomeViewModel and HomeScreen to remove the internal navigator, updating navigation tests accordingly, and migrating from BaseDestination to BaseAppDestination for navigation.

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
HomeViewModelTest.kt Removed navigation test and ensured models are loaded via explicit getModels() call.
HomeScreenTest.kt (unit & androidTest) Updated test callbacks for navigation and replaced BaseDestination usage with explicit event mocks and NavHostController navigation assertions.
ThirdScreen.kt, SecondScreen.kt, ItemList.kt, Item.kt Adjusted navigation and click callback parameters to use event callbacks with simplified parameter types.
HomeViewModel.kt Moved navigation logic out and exposed getModels() and checkIfFirstTimeLaunch() as explicit functions.
MainNavGraph.kt, MainDestination.kt, BaseAppDestination.kt, AppNavGraph.kt, AppDestination.kt Transitioned navigation types from BaseDestination to BaseAppDestination and updated composable navigation functions.
NavigationExt.kt, NavHostControllerExt.kt Introduced new navigation extensions and throttling mechanisms.
androidTest/HomeScreenTest.kt, HiltTestRunner.kt Updated androidTest setup with Hilt support and TestNavHostController for navigation assertions.
app/build.gradle.kts Modified testInstrumentationRunner to use the HiltTestRunner.
Comments suppressed due to low confidence (2)

sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt:93

  • The current navigation assertion calls hasRoute without verifying its result. Consider adding an explicit assertion (e.g., assertTrue) to confirm that the navigated route matches the expected one.
navController.currentBackStackEntry?.destination?.hasRoute(MainDestination.Second.route, null)

sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt:104

  • The navigation check for the Third screen does not assert the return value of hasRoute. Adding an explicit assertion would improve test reliability.
navController.currentBackStackEntry?.destination?.hasRoute(MainDestination.Third.route, null)

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