0.1.5 • Published 7 years ago

@srijs/hedgehog v0.1.5

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

hedgehog

Hedgehog is a modern property-based testing library.

It helps you write tests that catch more bugs with less code, are easier to write and to maintain.

You can use Hedgehog together with Mocha, Jest, and many other testing frameworks.

CircleCI npm (scoped) Codecov Greenkeeper badge

Installation

Hedgehog is available via npm.

npm install @srijs/hedgehog

Usage

Just use your favorite testing framework, and sprinkle in some forAll goodness:

import {forAll, Gen, Range} from '@srijs/hedgehog';

describe('arrays', () => {

    it('does not matter when an array is reversed twice', () => forAll({

        // Generate an array of booleans, with a length between 0 and 100.
        array: Gen.boolean().array(Range.linear(0, 100))

    }, ({array}) => {

        // Shallow copy the array and reverse it twice.
        const reversed = array.slice().reverse().reverse();
        // Compare it to the original array.
        expect(reversed).toEqual(array);

    }));

});

Todo

  • Performance tuning
  • Randomness tests (uniformity, etc)

License

MIT

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago