Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Basics: Viewmodel and State with Compose #211

Open
dbrandon07 opened this issue Sep 18, 2024 · 0 comments
Open

Android Basics: Viewmodel and State with Compose #211

dbrandon07 opened this issue Sep 18, 2024 · 0 comments

Comments

@dbrandon07
Copy link

Test Strategy
https://developer.android.com/codelabs/basic-android-kotlin-compose-test-viewmodel?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-4-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-test-viewmodel#3

To get the correct player guess, use the getUnscrambledWord() function, which takes in the currentGameUiState.currentScrambledWord as an argument and returns the unscrambled word. Store this returned value in a new read-only variable named correctPlayerWord and assign the value returned by the getUnscrambledWord() function.

@test
fun gameViewModel_CorrectWordGuessed_ScoreUpdatedAndErrorFlagUnset() {
var currentGameUiState = viewModel.uiState.value
val correctPlayerWord = getUnscrambledWord(currentGameUiState.currentScrambledWord)

}

Even when I pull the full Main branch from the repository that y'all provided, it still gives an error for the getUnscrambledWord() function. It is not importing the WordsData.kt file from the test package, just the main package which doesn't have that function. The Studio suggestion for resolving it always gives a circular dependency warning.

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

No branches or pull requests

1 participant