expect.js library is no longer maintained
expect.js library has been deprecated in favor of Chaijs.
Please migrate to the k6Chaijs library. The documentation below is retained for historical reasons.
toBeBetween(from, to) is a comparison function that evaluates to true or false. It must be called in the chain after the t.expect(value) or .and(value).
toBeBetween(from, to) is equivalent to value >= from && value <= to
When toBeBetween(from, to) evaluates to false, the chain is broken, and the test case is marked as failed. When the chain is broken, further checks inside of the test are omitted.
|from||Number||Beginning of the range (inclusive)|
|to||Number||End of the range (inclusive)|
When you run this test with k6 run mytest.js the result should look similar to this: