Package Exports
- @coderbyheart/jest-expect-tobewithin
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@coderbyheart/jest-expect-tobewithin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
expect.toBeWithin(number, number)
Use .toBeWithin when you want to check that a number is within a range.
For example, if you want to test that ouncesPerCan() returns a value between 5 and 20, write:
test('ounces per can is between 5 and 20', () => {
expect(ouncesPerCan()).toBeWithin(5, 20);
});Install
npm i @coderbyheart/jest-expect-tobewithinUsage
import { toBeWithin } from '@coderbyheart/jest-expect-tobewithin'
expect.extend({toBeWithin});
// In your test:
expect(10).toBeWithin(5,20)