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
Failed test output improvement suggestion for called.withArg(arg) & called.withArgs(arg) #62
Comments
If you called it many times should it output all the calls? var logger = deride.stub(['info']);
//...
logger.info('Something', { message: 'a message', code: 123}, {a: 123, b: 'a long string in here'});
logger.info('Another call to Info', { message: 'another message', code: 123456}, {a: 123234, b: 'another long string in here'});
// many other calls to logger.info
//...
logger.info('talula');
logger.expect.info.called.withArgs('talula'); What should it output? |
Maybe something like this: |
Well you could use: https://github.com/guzzlerio/deride#provide-access-to-individual-calls-to-a-method var bob = deride.wrap(bob);
bob.greet('jack', 'alice');
bob.greet('bob');
bob.expect.greet.invocation(0).withArg('alice');
bob.expect.greet.invocation(1).withArg('bob'); |
Ye that would work, it would be still be nice to give better feedback on failure when using |
For something that gets called once, twice or a relatively small number it would be good to say: Expected <method> to be called with arg: <arg> but was called with:
0: 'bob',
1: 'talula',
2: { a: 123, b: 'weqrewr'} but if you have something that is called a lot of times like a logger that would spam the output.... So after 5 distinct calls collapse into How about that? |
Ye sounds like a good plan. 👍 |
It would be great if when using
called.withArg(arg)
&called.withArgs(arg)
it produced output which was notexpected true but was false
.Ideally it would be nice if the output was what it was actually call with.
The text was updated successfully, but these errors were encountered: