By now, you've already seen plenty of usage examples for matchers, and probably can feel how they work.
You have seen how to use the
matchers. These are a few of the built-in matchers available in Jasmine, but we can extend Jasmine by writing matchers of our own.
So, to really understand how Jasmine matchers work, we need to create one ourselves.
Consider this expectation from the previous section:
Although it works, it is not very expressive. Imagine if we could rewrite it instead, as:
This makes a much better relation to the acceptance criterion:
"should be a good investment"→expect investment ...