@coderbyheart/jest-expect-tobewithin
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

expect.toBeWithin(number, number)

npm tested with jest Build Status Greenkeeper badge semantic-release Commitizen friendly Standard - JavaScript Style Guide

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-tobewithin

Usage

import { toBeWithin } from '@coderbyheart/jest-expect-tobewithin'

expect.extend({toBeWithin});

// In your test:
expect(10).toBeWithin(5,20)

Readme

Keywords

Package Sidebar

Install

npm i @coderbyheart/jest-expect-tobewithin

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • coderbyheart