Skip to content

Commit

Permalink
Add mavericks VM factory function to the list of VM factories (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmans0n authored Oct 2, 2022
1 parent a7e64d5 commit eb07123
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class ComposeViewModelInjection : ComposeKtVisitor {
"viewModel", // AAC VM
"weaverViewModel", // Weaver
"hiltViewModel", // Hilt
"injectedViewModel" // Whetstone
"injectedViewModel", // Whetstone
"mavericksViewModel" // Mavericks
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ComposeViewModelInjectionCheckTest {
private val rule = ComposeViewModelInjectionCheck(Config.empty)

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `passes when a weaverViewModel is used as a default param`(viewModel: String) {
@Language("kotlin")
val code =
Expand All @@ -33,7 +33,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `overridden functions are ignored`(viewModel: String) {
@Language("kotlin")
val code =
Expand All @@ -48,7 +48,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `errors when a weaverViewModel is used at the beginning of a Composable`(viewModel: String) {
@Language("kotlin")
val code =
Expand Down Expand Up @@ -79,7 +79,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `errors when a weaverViewModel is used in different branches`(viewModel: String) {
@Language("kotlin")
val code =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ComposeViewModelInjectionCheckTest {
private val injectionRuleAssertThat = assertThatRule { ComposeViewModelInjectionCheck() }

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `passes when a weaverViewModel is used as a default param`(viewModel: String) {
@Language("kotlin")
val code =
Expand All @@ -30,7 +30,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `overridden functions are ignored`(viewModel: String) {
@Language("kotlin")
val code =
Expand All @@ -44,7 +44,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `errors when a weaverViewModel is used at the beginning of a Composable`(viewModel: String) {
@Language("kotlin")
val code =
Expand Down Expand Up @@ -82,7 +82,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `errors when a weaverViewModel is used in different branches`(viewModel: String) {
@Language("kotlin")
val code =
Expand Down Expand Up @@ -111,7 +111,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `fix no args composable function adds the code inside the parentheses`(viewModel: String) {
@Language("kotlin")
val badCode = """
Expand Down Expand Up @@ -139,7 +139,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `fix normal args composable function adds the new code at the end`(viewModel: String) {
@Language("kotlin")
val badCode = """
Expand All @@ -166,7 +166,7 @@ class ComposeViewModelInjectionCheckTest {
}

@ParameterizedTest
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel"])
@ValueSource(strings = ["viewModel", "weaverViewModel", "hiltViewModel", "injectedViewModel", "mavericksViewModel"])
fun `fix trailing lambda args composable function adds the new code before the trailing lambda`(viewModel: String) {
@Language("kotlin")
val badCode = """
Expand Down

0 comments on commit eb07123

Please sign in to comment.