-
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
Invocation sequence testing #277
Comments
This does not exist, so far by design. My issues with it:
If you'd like this to be incorporated into td.js, I'd love to see some examples of production functions that you think demand in-order verification |
Thanks for taking the time to respond to my request. In my project, I'm using Restify to construct a REST API. In Restify you mount response handlers to an API path + an HTTP method, like this:
These handlers can be chained. Which is where the next() method call comes in. In most cases you call next last in your handler method to ensure any logic that you want to perform to deal with the request is handled before and not after the request has been passed along to the next handler. So in this very simple case you would test that res.send is called before next. My initial suggestion was merely a "TD translation" of the Mockito way of doing things. In Mockito the inOrder method takes in a single instance of each of the test doubles that needs to verified but it's the order of the inOrder.verify calls that actually determine the expected order.
I do agree though, things could definitely be made more clear. Perhaps something like this |
Maybe we could just extend the current Something like:
We might need to suppress the standard console warning when testdouble detects that a stubbed invocation is also being verified in the case a verify sequence is supplied. My reasoning is that sequence could be an interesting thing to observe for intermediate mock interactions within the system under test. |
Hi,
Newbie question/request here. I just started porting a smaller project over from Sinon to TD. Coming from the Java world and Mockito I really prefer TD's approach.
What I haven't been able to figure out is if there's any way to test the sequence of calls like you can with Sinon's calledAfter/calledBefore. I was hoping to find something similar to Mockito.inOrder.
E.g.
Is this something that does exist but isn't covered by the documentation? If not, please consider this a feature request.
The text was updated successfully, but these errors were encountered: