fancy-test
Version:
extendable utilities for testing
18 lines • 465 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("lodash");
/**
* mocks an object's property
*/
exports.default = (object, path, value) => ({
run(ctx) {
ctx.stubs = ctx.stubs || [];
ctx.stubs.push(_.get(object, path));
_.set(object, path, value);
},
finally(ctx) {
const stub = ctx.stubs.pop();
_.set(object, path, stub);
},
});
//# sourceMappingURL=stub.js.map