Checking Two Boundaries With Jasmine (between Matcher)
In Jasmine, there are toBeGreaterThan and toBeLessThan matchers. What if I want to check an integer value in a specific range? Is there anything like toBeInBetween matcher? Current
Solution 1:
You can run the boolean comparison and assert the result is true
:
expect(x > 1 && x < 10).toBeTruthy();
Also, there is toBeWithinRange()
custom matcher introduced by jasmine-matchers
:
expect(x).toBeWithinRange(2, 9); // range borders are included
Post a Comment for "Checking Two Boundaries With Jasmine (between Matcher)"