-
Notifications
You must be signed in to change notification settings - Fork 142
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
Inifinite recursion problem #231
Comments
I don't understand what you're trying to accomplish with the above configuration. Rather than critique a lot about what I can see in the above example with testing craft/theory, could you provide a minimal example function so I can show how I would test it? |
(Closing for now, because using |
I think this can be a normal use case, waiting for a stub to be called to verifiy and finish a test, since the stub is at the end of a promise chain, there's a need to wait for it. Anyway found a work around: setTimeout(() => {
td.verify(reply)
done()
}) This way the verification is only done in the nextTick after the promises are executed (note: does not work using |
I mean to say you should never need to verify that which you have also stubbed. It has, by definition, already been called. Can you provide an example of code needed to be tested? |
What I'm doing is verifying the response to commands of a microservice (slack bot) Its not integration tests, but really makes the tests much more readable and meaningful by verifying the bot responses to commands. Example in pseudo code: td.object(bot.api1)
td.object(bot.api2)
bot.reply = td.function()
it ('responds api data from "get api services"')
td.when(bot.api1.get()).thenResolve('ok')
td.when(bot.api2.get()).thenResolve('ok')
bot.eval("get api services")
td.verify(bot.reply(td.matchers.contains(/ok ok/i)) hope this make sense, anyway I'm now able to wait for the bot reply at the end of promise chains to by using |
I hate to ask for a third time but can you please send an example of the code being tested if you want help |
thanks Searls, not necessary, I'll create a gist if get stuck in a related issue in the future |
I'm stubbing a method that is only called after a promise chain, to complete the test I must wait for that method to be called asynchronously, but when I start verifying the results I get stuck in an infinite loop.
Easier to understand with a code example:
I am fairly new to this framework, is there anything I should be doing instead? Or is this a limitation?
The text was updated successfully, but these errors were encountered: