jest-theories
Advanced tools
Comparing version
@@ -29,9 +29,10 @@ 'use strict'; | ||
theories.forEach(function (theory, idx) { | ||
for (var idx = 0; idx < theories.length; idx++) { | ||
var theory = theories[idx]; | ||
var testName = isFunctionTestNameCreator ? testNameCreator(theory, idx) : (0, _stringFormat2.default)(testNameCreator, Object.assign({}, theory, { "$idx": idx, "$no": idx + 1 })); | ||
test(testName, testFunc.bind(undefined, theory)); | ||
}); | ||
} | ||
}; | ||
exports.default = theoretically; |
@@ -7,3 +7,3 @@ /** | ||
*/ | ||
declare function theoretically<T>(description: string | ((theory: T, index: number) => string), theories: T[], testFunction: (theory: T) => void): void; | ||
declare function theoretically<T>(description: string | ((theory: T, index: number) => string), theories: T[], testFunction: (theory: T) => Promise<void> | void): void; | ||
export default theoretically; |
@@ -13,7 +13,8 @@ import format from 'string-format'; | ||
if(!isFunctionTestNameCreator && typeof testNameCreator !== 'string') { | ||
if (!isFunctionTestNameCreator && typeof testNameCreator !== 'string') { | ||
throw new Error('Test name creator must be a string or a function') | ||
} | ||
theories.forEach((theory, idx) => { | ||
for (let idx = 0; idx < theories.length; idx++) { | ||
const theory = theories[idx] | ||
const testName = isFunctionTestNameCreator | ||
@@ -27,5 +28,5 @@ ? testNameCreator(theory, idx) | ||
); | ||
}); | ||
} | ||
}; | ||
export default theoretically; |
{ | ||
"name": "jest-theories", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "babel index.js --out-dir dist" |
6528
1.7%5270
24.62%56
3.7%