GraphQLTest: No Root resolvers for mutation/query type when running unit test #416
-
Describe the bug I've createted two GrahpQL Schemas separately for two diferent types. Then, I've implemented The problem occurs with unit testing using Whenever I run unit test for QueryResolver, I got and error:
The same occurs when unit testing MutationResolver:
Query test runs normally if I remove type Mutation from the schema. What I'm missing here? To Reproduce Demo project that reproduces the behavior. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Packaging by layer solves the problem. But I'd like continue using the first approach. |
Beta Was this translation helpful? Give feedback.
-
Have you tried adding |
Beta Was this translation helpful? Give feedback.
-
@AndreKunitz Did my previous suggestion fix the issue for you? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late response. Indeed, your suggestion fixed the issue. Thanks a lot, @oliemansm. |
Beta Was this translation helpful? Give feedback.
Have you tried adding
@ComponentScan("me.github.andrekunitz.issueexemple")
to your test classes when packaged by feature? There's a@ComponentScan
without specifying any packages on the@GraphQLTest
annotation, which might result in it scanning only the package that test class is defined in, instead of the root package.