Ellisande / mockolate

Simple mocking framework for JS
MIT License
1 stars 3 forks source link

History #18

Closed Ellisande closed 8 years ago

Ellisande commented 8 years ago

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature

What is the current behavior? (You can also link to an open relevant tickets here)

The only verification available is the number of times the function is invoked.

What is the new behavior (if this is a feature change)?

This is a first step towards a more robust history and verification for mocked functions.

Where should the reviewer start?

The history.js file.

This is how I tested it

Lots, and lots of tests.

Does this PR introduce a breaking change?

Yes. If yes:

Ellisande commented 8 years ago

This is a proposal for a start on a more robust history and verification API. Now this is pretty different than several other mocking frameworks. The proposed pattern looks like:

const ninja: {
  getArsenal: mockFunction()
};
const callHistory = ninja.getArsenal.called();
const subsetOfHistory = ninja.getArsenal.called.with('a');
const numTimesCalled = callHistory.length;
Ellisande commented 8 years ago

@msquare711 @guyellis this would be a breaking change, and is a bit different then the approach other mocking frameworks have taken. Any thoughts or insight on it would be greatly appreciated.