testdouble
Version:
A minimal test double library for TDD with JavaScript
16 lines (15 loc) • 591 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const call_log_1 = require("../value/call-log");
const call_1 = require("../value/call");
const satisfy_1 = require("../satisfy");
function generateFakeFunction(double) {
const testDouble = function testDouble(...args) {
const call = new call_1.default(this, args);
call_log_1.default.instance.log(double, call);
return (0, satisfy_1.default)(double, call);
};
testDouble.toString = double.toString.bind(double);
return testDouble;
}
exports.default = generateFakeFunction;