jasmine-test-cases
Version:
Parametrized test cases for Jasmine
31 lines (30 loc) • 1.24 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.using = void 0;
var expectify_1 = require("./core/expectify");
var wrap_1 = require("./core/wrap");
function using(arg) {
var runs = [[].slice.call(arguments)];
if (runs[0].length === 0) {
throw new Error('Got no arguments for using 1');
}
var context = this;
var wrapper = {
it: (0, wrap_1.wrap)(function () { return runs; }, context, 'it'),
xit: (0, wrap_1.wrap)(function () { return runs; }, context, 'xit'),
fit: (0, wrap_1.wrap)(function () { return runs; }, context, 'fit'),
using: function () {
var args = [].slice.call(arguments), n = runs[0].length;
if (args.length === 0) {
throw new Error("Got no arguments for using ".concat(runs.length + 1));
}
if (args.length !== n) {
throw new Error("Expecting ".concat(n, " argument").concat(n === 1 ? '' : 's', " but got ").concat(args.length, " for using ").concat((0, expectify_1.expectify)(args)));
}
runs.push(args);
return wrapper;
}
};
return wrapper;
}
exports.using = using;
;