jsmockito icon indicating copy to clipboard operation
jsmockito copied to clipboard

Add ability to view unmatched interactions on a mock

Open Bringer128 opened this issue 11 years ago • 1 comments

In Mockito, when using verify() you get a list of all the interactions with a mock on a failure.

So the use cases would be:

var func = mockFunction();
func('abc');
verify(func)('def');
// Prints the following: 
// Wanted but not invoked: func('def')
// However, there were these interactions: 
// --> func('abc')
var func = mockFunction();
func('abc');
func('def');
verifyNoInteractions(func);
// Prints the following: 
// Wanted not invoked: func('abc')
// However, there were these interactions: 
// --> func('abc')
// --> func('def')

etc.

I've been prototyping this change and it doesn't look too hard, I've just run into some problems running the unit tests (the browser locks up). Should I be using ant to run them?

Bringer128 avatar Dec 11 '13 01:12 Bringer128

Hi @Bringer128,

You can use Ant, or just run them in the browser. I haven't worked on JsMockito in some time, and it was written back when the only real headless option was Rhino. It would be ideal to re-package it (and probably rewrite the unit tests) to run on node.js now. At some point I may find the time to do that!

Cheers, Chris

cleishm avatar Dec 18 '13 06:12 cleishm