JSPM

@coderbyheart/jest-expect-tobewithin

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q64488F
  • License MIT

This adds the .toBeWithin(number, number) to expect.

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)

npm tested with jest Build Status Greenkeeper badge semantic-release Commitizen friendly

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)