{"name":"muk-prop","description":"Mock object methods and properties.","keywords":["test","mock","stub"],"version":"3.0.1","repository":{"type":"git","url":"git://github.com/fent/muk-prop.js.git"},"author":{"name":"fent","url":"https://github.com/fent"},"main":"./lib/index.js","scripts":{"test":"istanbul cover node_modules/.bin/_mocha -- -R spec test/*-test.js"},"directories":{"lib":"./lib"},"devDependencies":{"istanbul":"^0.4.5","mocha":"^6.0.0"},"engines":{"node":">=6"},"license":"MIT","gitHead":"794adfdd52d4b57acb8dfd7a6064a33e1bdc6be1","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"homepage":"https://github.com/fent/muk-prop.js#readme","_id":"muk-prop@3.0.1","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-V2T5sxU50WC9EsEXnf7XSXuQVhx4/2g/6Ox1Rp0GyqTthH0f7isGrGI705RHL56awIQaYpaCFDPbWzqgBGnBng==","shasum":"6deff523eddf7a2778b0c977264bf2166715e2d5","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-3.0.1.tgz","fileCount":4,"unpackedSize":4680,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCaCoi5hTgO2wIITok35BPXNQPkA73qF1/mhFiQ4fWIjAIgXQKlZf1KitZXMsrcWBVWNWC3PbTeim6kEIG4h76W18s="}],"size":2370,"noattachment":false,"key":"/muk-prop/-/muk-prop-3.0.1.tgz"},"_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"maintainers":[{"name":"fent","email":"fentbox@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/muk-prop_3.0.1_1684125775911_0.9449553869794314"},"_hasShrinkwrap":false,"readme":"# muk-prop.js\n\n[![Build Status](https://secure.travis-ci.org/fent/muk-prop.js.svg)](http://travis-ci.org/fent/muk-prop.js)\n[![Dependency Status](https://david-dm.org/fent/muk-prop.js.svg)](https://david-dm.org/fent/muk-prop.js)\n[![codecov](https://codecov.io/gh/fent/muk-prop.js/branch/master/graph/badge.svg)](https://codecov.io/gh/fent/muk-prop.js)\n\n![muk](muk.gif)\n\n# Usage\n\nObject method mocking.\n\n```js\nconst fs = require('fs');\nconst muk = require('muk-prop');\n\nmuk(fs, 'readFile', (path, callback) => {\n  process.nextTick(callback.bind(null, null, 'file contents here'));\n});\n```\n\nObject props mocking with setter/getter.\n\n```js\nconst muk = require('muk-prop');\n\nconst obj = { _a: 1 };\nmuk(obj, 'a', {\n  set: (val) => obj._a = val * 2,\n  get: (val) => obj._a,\n});\n\nobj.a = 2;\nconsole.log(obj.a); // 4\n```\n\nCheck if member has been mocked.\n\n```js\nmuk.isMocked(fs, 'readFile'); // true\n```\n\nRestore all mocked methods/props after tests.\n\n```js\nmuk.restore();\n\nfs.readFile(file, (err, data) => {\n  // will actually read from `file`\n});\n```\n\n\n# Install\n\n    npm install muk-prop\n\n\n# Tests\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n","publish_time":1684125776068,"_cnpm_publish_time":1684125776068,"dist-tags":{"latest":"3.0.2"}}