adams.co.tt

Updated jasmine-underscore

14th March 2012

Last year jasmine-underscore was released. Since then, some issues have been fixed, and two new matchers have also been included:

allToSatisfy
expect([2, 4, 6]).allToSatisfy(function (val) { return val%2 == 0; });
expect([1, 4, 6]).not.allToSatisfy(function (val) { return val%2 == 0; });
anyToSatisfy
expect([2, 3, 5]).anyToSatisfy(function (val) { return val%2 == 0; });
expect([1, 3, 5]).not.anyToSatisfy(function (val) { return val%2 == 0; });

These matchers allow any predicate to be applied to element of a collection, with the test only passing if all/any of the elements in collection satisfy the predicate.

Get version 1.1 here. Enjoy!

blog comments powered by Disqus