🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

jest-theories

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-theories - npm Package Compare versions

Comparing version

to
1.1.0

4

dist/index.js

@@ -23,4 +23,4 @@ 'use strict';

theories.forEach(function (theory) {
test((0, _stringFormat2.default)(testName, theory), testFunc.bind(undefined, theory));
theories.forEach(function (theory, idx) {
test((0, _stringFormat2.default)(testName, Object.assign({}, theory, { "$idx": idx, "$no": idx + 1 })), testFunc.bind(undefined, theory));
});

@@ -27,0 +27,0 @@ };

import format from 'string-format';
const theoretically = (testName, theories, testFunc) => {
if(!test){
if (!test) {
throw new Error('Jest test global must be accessible to use jest-theories');
}
if(!Array.isArray(theories)){
throw new Error('Theories must be an array (was '+ typeof theories + ')');
if (!Array.isArray(theories)) {
throw new Error('Theories must be an array (was ' + typeof theories + ')');
}
theories.forEach(theory => {
test(format(testName, theory), testFunc.bind(this, theory));
theories.forEach((theory, idx) => {
test(
format(testName, Object.assign({}, theory, { "$idx": idx, "$no": idx + 1 })),
testFunc.bind(this, theory)
);
});

@@ -14,0 +17,0 @@ };

{
"name": "jest-theories",
"version": "1.0.3",
"version": "1.1.0",
"scripts": {

@@ -5,0 +5,0 @@ "build": "babel index.js --out-dir dist"

@@ -29,5 +29,7 @@ # jest-theories

Additionally to the fields available in your theory you can also use `$idx` for the index of the theory and `$no` for the number of the theory.
## Inspiration
Inspiration from [jasmine-theories](https://github.com/hypesystem/jasmine-theories) and XUnit.