{"name":"muk-prop","description":"Mock object methods and properties.","keywords":["test","mock","stub"],"version":"3.0.0","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":"c8353bb79aa6432758cf5e27792d3a2200d7d277","bugs":{"url":"https://github.com/fent/muk-prop.js/issues"},"homepage":"https://github.com/fent/muk-prop.js#readme","_id":"muk-prop@3.0.0","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-1pmuhJphBFIgXmM+7D73vWvdWKqi7IM6Q7UrKpJRzkvw+TfD1heYTzMHR20DgiUbO2oZvpfx5SF4cIpaysLqKw==","shasum":"e5490132171348778dc2648cd167bf81d554fe93","tarball":"http://registry-npm.ywwl.com/muk-prop/download/muk-prop-3.0.0.tgz","fileCount":4,"unpackedSize":4512,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHpUWt93PWccaiueoyWXwidVNAlrEhN8s6C0g+JA0Sl5AiAyuVxFIOsV47/yqumEzgk+grV5P11Zb5aS+NF/xEERGQ=="}],"size":2325,"noattachment":false,"key":"/muk-prop/-/muk-prop-3.0.0.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.0_1683857633398_0.967652197676643"},"_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":1683857633586,"_cnpm_publish_time":1683857633586,"dist-tags":{"latest":"3.0.2"}}