# @galacticdevelopment/jasmine-check

> Generative property tests for Jasmine

Latest version **1.0.0-rc.1** (published 2018-03-30) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @galacticdevelopment/jasmine-check
pnpm add @galacticdevelopment/jasmine-check
yarn add @galacticdevelopment/jasmine-check
bun add @galacticdevelopment/jasmine-check
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-rc.1 |
| Published | 2018-03-30 |
| First published | 2018-03-30 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1171 |
| Author | Lee Byron |
| Maintainers | ladysamantha |
| Keywords | jasmine, quickcheck, testcheck, generative, property, test |

## Links

- npm: https://www.npmjs.com/package/@galacticdevelopment/jasmine-check
- Repository: https://github.com/leebyron/testcheck-js
- Homepage: https://github.com/leebyron/testcheck-js/tree/master/integrations/jasmine-check
- Issues: https://github.com/leebyron/testcheck-js/issues
- npm.io page: https://npm.io/package/@galacticdevelopment/jasmine-check

## Dependencies (1)

- [testcheck](https://npm.io/package/testcheck.md) ^1.0.0-rc

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.0-rc.1 (latest) — 2018-03-30

## README

Generative property testing for Jasmine
=======================================

`jasmine-check` adds the generative testing power of [`testcheck-js`](https://github.com/leebyron/testcheck-js)
to [Jasmine](http://jasmine.github.io/). This allows some of your Jasmine tests
to accept arguments and ensure your tests pass not just under your contrived
test cases but also pass for hundreds of randomly generated test cases.


Getting started
---------------

Install `jasmine-check` using npm.

```shell
npm install jasmine-check
```

Then include and install `jasmine-check` before your test suite.

```javascript
require('jasmine-check').install();
```


Example
-------

```javascript
require('jasmine-check').install();

describe('MySpec', () => {

  check.it('accepts an int and a string', gen.int, gen.string, (x, y) => {
    expect(x).toEqual(jasmine.any(Number));
    expect(y).toEqual(jasmine.any(String));
  });

});
```

The `gen` global object is provided directly by `testcheck-js` and defines what
type of random values to generate. The test will be run numerous times with
different random values, ensuring all expectations are met for every run. If a
test expectation fails, then the test will re-run with "smaller" values until
the smallest failing value is found which can better help explain edge cases
with your test and produce consistent results, despite being initially fueled
by randomness.

### Options

If a test is taking a long time, needs to generate larger values, or should be
run with a consistent random seed, you can alter the behavior with `options`:

```js
{
  times: number;   // the number of test cases to run. Default: 100
  maxSize: number; // the maximum "size" of the test data. Default: 200
  seed: number;    // defaults to a random value from 1 to 2^32-1.
}
```

To use these options with your check, include an options object after
the description:

```js
check.it('runs 10 times', {times: 10}, gen.sPosInt, x => {
  expect(x).toBeGreaterThan(0);
});
```

To learn more about property testing, or to learn about the available value
generators, check out [`testcheck-js`](https://github.com/leebyron/testcheck-js).

---
_Source: https://npm.io/package/@galacticdevelopment/jasmine-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
