1) If we're speaking about Vue Apollo composables, we don't test them in isolation. It will be the same component test with @vue/apollo-composable. If we're speaking about "how to test an abstract standalone custom composable" - it's a bit of a different question and I would need a better research to answer it (currently, we're still using Vue 2 so I can't have a lot of hands on experience with composables in prod). I'll try to look into it.
2) I prefer pure vue-test-utils over vue-testing-library but it's just a personal preference
To be honest I came to Vue from react world and especially from Apollo client there. For me useQuery is kind of hook and work the same way as in react(declarative), so I expected to test it also easily that I did before. I also think that using this approach is the future for Vue(for react Apollo client it is already a standard) itself because it is much simpler, what disappointed me is a lack of tools and documentation , but thank you 🙏 for people like you who provide this information like this post.
I expected that I wrapped my Vue component with MockProvider, provide some mock data and I am done. But now what I see that is so many complexity involved and I have not two many options left and all of them involved so many boilerplate in code and also in tests(instead of two lines with useQuery and useResult)
So if you would give some advices how to keep in code this two methods and also write tests for this components I would really appreciate that 🙏
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Amazing topic, thank you for your work. Two questions:
What about vue-composable code and testing of it(currently in internet there are no docs and exapmles about that :(
What about vue-testing-library, currently it is also not so much examples. Would be amazing if you are also provide some examples :)
If you give any comments on that will be very appreciated :)
1) If we're speaking about Vue Apollo composables, we don't test them in isolation. It will be the same component test with @vue/apollo-composable. If we're speaking about "how to test an abstract standalone custom composable" - it's a bit of a different question and I would need a better research to answer it (currently, we're still using Vue 2 so I can't have a lot of hands on experience with composables in prod). I'll try to look into it.
2) I prefer pure vue-test-utils over vue-testing-library but it's just a personal preference
To be honest I came to Vue from react world and especially from Apollo client there. For me useQuery is kind of hook and work the same way as in react(declarative), so I expected to test it also easily that I did before. I also think that using this approach is the future for Vue(for react Apollo client it is already a standard) itself because it is much simpler, what disappointed me is a lack of tools and documentation , but thank you 🙏 for people like you who provide this information like this post.
I expected that I wrapped my Vue component with MockProvider, provide some mock data and I am done. But now what I see that is so many complexity involved and I have not two many options left and all of them involved so many boilerplate in code and also in tests(instead of two lines with useQuery and useResult)
So if you would give some advices how to keep in code this two methods and also write tests for this components I would really appreciate that 🙏