Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ava-fast-check

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ava-fast-check

Property based testing for AVA based on fast-check

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
increased by229.84%
Maintainers
1
Weekly downloads
 
Created
Source

Property based testing for AVA based on fast-check

Build Status npm version

Bring the power of property based testing framework fast-check into ava. ava-fast-check simplifies the integration of fast-check into ava testing framework.

Getting started

Install ava-fast-check and its peer dependencies:

npm install --save-dev ava fast-check ava-fast-check

Example

import { testProp, fc } from 'ava-fast-check';

// for all a, b, c strings
// b is a substring of a + b + c
testProp('should detect the substring', [fc.string(), fc.string(), fc.string()], (a, b, c) => {
  return (a + b + c).includes(b);
});

Please note that the properties accepted by ava-fast-check as input can either be synchronous or asynchronous (even just PromiseLike instances).

Advanced

If you want to forward custom parameters to fast-check, testProp accepts an optional fc.Parameters (more).

ava-fast-check also comes with .only, .skip and .failing from ava.

import { testProp, fc } from 'ava-fast-check';

testProp('should replay the test for the seed 4242', [fc.nat(), fc.nat()], (a, b) => {
  return a + b === b + a;
}, { seed: 4242 });

testProp.failing('should be skipped', [fc.fullUnicodeString()], text => {
  return text.length === [...text].length;
});

Minimal requirements

  • ava >=0.1.0 for its Promise support
  • fast-check ^1.0.0

Keywords

FAQs

Package last updated on 02 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc