Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "verify-it", | ||
"version": "1.0.1", | ||
"description": "Test property generation for NodeJS", | ||
"version": "1.1.0", | ||
"description": "Randomised test property/data generation for NodeJS", | ||
"main": "index.js", | ||
@@ -21,2 +21,5 @@ "scripts": { | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"homepage": "https://github.com/bbc/verify-it#readme", | ||
@@ -38,3 +41,3 @@ "dependencies": { | ||
"spdx-copyleft": "^0.1.1", | ||
"standard": "^10.0.3" | ||
"standard": "^11.0.0" | ||
}, | ||
@@ -41,0 +44,0 @@ "standard": { |
# `verify-it` | ||
_Test property generation for NodeJS._ | ||
_Randomised test property/data generation for NodeJS._ | ||
[](https://standardjs.com) | ||
[](https://travis-ci.org/bbc/verify-it) | ||
[](https://david-dm.org/bbc/verify-it) | ||
@@ -39,3 +40,3 @@ [](https://david-dm.org/bbc/verify-it?type=dev) | ||
) | ||
verify.it('should allow testing of asynchronous callbacks if the test framework supports it', () => { | ||
@@ -42,0 +43,0 @@ Gen.string, Gen.object, myGenerator, |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const Random = require('random-js') | ||
@@ -2,0 +4,0 @@ const FunctionEnumerator = require('./util/FunctionEnumerator') |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const CombinationGenerators = function (random, maxDistinctRetries) { | ||
@@ -8,3 +10,3 @@ const generateDistinct = (generator, existing, remainingRetries) => { | ||
const newValue = generator() | ||
if (existing.includes(newValue)) { | ||
if (existing.indexOf(newValue) !== -1) { | ||
return generateDistinct(generator, existing, remainingRetries - 1) | ||
@@ -11,0 +13,0 @@ } else { |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const ErrorGenerators = function (random) { | ||
@@ -2,0 +4,0 @@ this.error = () => new Error(random.string(20)) |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const NumericGenerators = function (random) { | ||
@@ -2,0 +4,0 @@ const MaxRealValue = Number('1E10') |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const ObjectGenerators = function (random) { | ||
@@ -18,3 +20,4 @@ const createObject = (propertyNames) => { | ||
this.objectWith = (...propertyNames) => { | ||
this.objectWith = function () { | ||
const propertyNames = [].slice.call(arguments) | ||
if (propertyNames.length === 0) { | ||
@@ -21,0 +24,0 @@ throw new Error('At least one property name must be provided') |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const SelectionGenerators = function (random) { | ||
@@ -2,0 +4,0 @@ this.pick = (values) => { |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const StringGenerators = function (random) { | ||
@@ -2,0 +4,0 @@ const generateString = () => random.string(random.integer(1, 100)) |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const ScenarioBuilder = function () { | ||
@@ -13,5 +15,7 @@ const createFunctionWithCorrectArgsLength = (numberOfArgs, fn) => { | ||
const scenario = function (...args) { | ||
const scenario = function (args) { | ||
const argumentsArray = [].slice.call(arguments) | ||
const inputs = generators.map((generator) => generator()) | ||
return body(...inputs, ...args) | ||
const bodyArguments = inputs.concat(argumentsArray) | ||
return body.apply(null, bodyArguments) | ||
} | ||
@@ -18,0 +22,0 @@ |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const ScenarioRunner = function (it, scenarioBuilder) { | ||
@@ -2,0 +4,0 @@ this.run = function () { |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const enumerate = (object) => { | ||
@@ -2,0 +4,0 @@ return Object.getOwnPropertyNames(object).filter((name) => typeof object[name] === 'function') |
27700
17
265
90