How can I unit-test a method which is using BatchDataLoader? #7120
Unanswered
yansklyarenko
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a method which is using BatchDataLoader and I want to write a unit test for it. My version of HotChocolate is very old (10.5.2), but this is something I can't influence right now...
So, here is the method:
I understand that I need to somehow mock the
IResolverContext
. So, I do it like this (a snippet from theAutoSetup
method):Now, when I run the test, it gets to the
return
line, enters theLoadAsync
method and then just hangs. The method under test was usingCacheDataLoader
before, and at that time the tests passed just fine.I would appreciate if you have an idea what could be wrong with this setup.
Is it at all possible to mock the
IResolverContext
the way to make test work?Beta Was this translation helpful? Give feedback.
All reactions