{"_id":"007","_rev":"11-dc1d106e3019b8aacc8d45181201a186","name":"007","description":"Returns a deep copy of an object with all functions converted to spies","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.0":{"name":"007","version":"0.0.0","description":"Returns a deep copy of an object with all functions converted to spies","main":"007.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/btford/007.git"},"keywords":["testing","test","mock","spy"],"author":{"name":"Brian Ford"},"license":"MIT","bugs":{"url":"https://github.com/btford/007/issues"},"readme":"# 007\n\nReturns a deep copy of an object with all functions converted to spies.\n\n## Install\n\nInstall with `npm`:\n\n```\nnpm install 007\n```\n\n## Example\n\n```\n// we want to test github\nvar github = require('github');\nvar doubleOhSeven = require('007');\nvar mockGithub = doubleOhSeven(github);\n\nmockGithub.pullRequests.getCommits.returns = function () {\n  return {\n    foo: 'beep'\n  };\n};\n\nassert(mockGithub.pullRequests.getCommits('lalala').foo === 'beep');\nassert(mockGithub.pullRequests.getCommits.callCount === 1);\n\n```\n\n## API\n\n### `doubleOhSeven()`\n\nTakes an object or function as an argument, returns a function or object matching the original, but with mocked out functions.\n\n### `mockFn.implementation`\n\nThe implementation of the mock function.\nSet with `=`:\n\nEx:\n```\nmockFn.implementation = function (val, cb) {\n  return cb(val + 1);\n};\n```\n\nThe following functions are helpers for implementation; using them will override `mockFn.implementation`.\n\n#### `mockFn.returns()`\n\nThe return value of the mock.\n\nEx:\n```\nmockFn.returns('foo');\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n#### `mockFn.callbackArgs`\n\nThe callback args to be invoked by the mock.\n\nEx:\n```\nmockFn.callbackArgs(['foo']);\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n## License\nMIT\n","readmeFilename":"README.md","_id":"007@0.0.0","dist":{"shasum":"7d5436039df0c3c2bed056eafa12f587da45349a","tarball":"https://registry.npmjs.org/007/-/007-0.0.0.tgz","integrity":"sha512-8A4rQFPSb4jaFFKocJEpTn+/tgrO2OloKBBqq9NlEnVVAoUcQt/IvJ+yBFZ/x8W86ZXoI721cL2h9OwUiGqITg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyS44DSh1u1QPdqAT3zpt+y92bMERJFBGSNqg2gAb63wIgPj3woNgwLAE7enEqIUutoO+EOQaDlLK/tIPm5RbxdYU="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"btford","email":"briantford@gmail.com"},"maintainers":[{"name":"btford","email":"briantford@gmail.com"}]},"0.0.1":{"name":"007","version":"0.0.1","description":"Returns a deep copy of an object with all functions converted to spies","main":"007.js","scripts":{"test":"mocha tests/"},"repository":{"type":"git","url":"git://github.com/btford/007.git"},"keywords":["testing","test","mock","spy"],"author":{"name":"Brian Ford"},"license":"MIT","bugs":{"url":"https://github.com/btford/007/issues"},"devDependencies":{"should":"~1.2.2","mocha":"~1.12.0"},"readme":"# 007\n[![Build Status](https://travis-ci.org/btford/007.png?branch=master)](https://travis-ci.org/btford/007)\n\nReturns a deep copy of an object with all functions converted to spies.\n\n## Install\n\nInstall with `npm`:\n\n```\nnpm install 007\n```\n\n## Example\n\n```\n// we want to test github\nvar github = require('github');\nvar doubleOhSeven = require('007');\nvar mockGithub = doubleOhSeven(github);\n\nmockGithub.pullRequests.getCommits.returns = function () {\n  return {\n    foo: 'beep'\n  };\n};\n\nassert(mockGithub.pullRequests.getCommits('lalala').foo === 'beep');\nassert(mockGithub.pullRequests.getCommits.callCount === 1);\n\n```\n\n## API\n\n### `doubleOhSeven()`\n\nTakes an object or function as an argument, returns a function or object matching the original, but with mocked out functions.\n\n### `mockFn.implementation`\n\nThe implementation of the mock function.\nSet with `=`:\n\nEx:\n```\nmockFn.implementation = function (val, cb) {\n  return cb(val + 1);\n};\n```\n\nThe following functions are helpers for implementation; using them will override `mockFn.implementation`.\n\n#### `mockFn.returns()`\n\nThe return value of the mock.\n\nEx:\n```\nmockFn.returns('foo');\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n#### `mockFn.callbackArgs()`\n\nThe callback args to be invoked by the mock.\n\nEx:\n```\nmockFn.callbackArgs(['foo']);\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n## License\nMIT\n","readmeFilename":"README.md","_id":"007@0.0.1","dist":{"shasum":"6c95a2246175be8ec86b05f16c26bdb299f2a516","tarball":"https://registry.npmjs.org/007/-/007-0.0.1.tgz","integrity":"sha512-+/+RUmHxr1nemXh0lbuUf6N1V5dicCSmuCOKuX2H6yoe60quPXXxzPUbAvFrBX+Wk+TcrW7KYxuXto6bvpdKig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvLsvx1+1dUupn2RekN9twZCNusoBemCHzK/I1ANhTcAIhAMqI81fRXmRr5cjxrEruFuUj8GSKrHlz0/xD6MwDzll5"}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"btford","email":"briantford@gmail.com"},"maintainers":[{"name":"btford","email":"briantford@gmail.com"}]},"0.0.2":{"name":"007","version":"0.0.2","description":"Returns a deep copy of an object with all functions converted to spies","main":"007.js","scripts":{"test":"mocha tests/"},"repository":{"type":"git","url":"git://github.com/btford/007.git"},"keywords":["testing","test","mock","spy"],"author":{"name":"Brian Ford"},"license":"MIT","bugs":{"url":"https://github.com/btford/007/issues"},"devDependencies":{"should":"~1.2.2","mocha":"~1.12.0"},"readme":"# 007\n[![Build Status](https://travis-ci.org/btford/007.png?branch=master)](https://travis-ci.org/btford/007)\n\nReturns a deep copy of an object with all functions converted to spies.\n\n## Install\n\nInstall with `npm`:\n\n```\nnpm install 007\n```\n\n## Example\n\n```\n// we want to test github\nvar github = require('github');\nvar doubleOhSeven = require('007');\nvar mockGithub = doubleOhSeven(github);\n\nmockGithub.pullRequests.getCommits.returns = function () {\n  return {\n    foo: 'beep'\n  };\n};\n\nassert(mockGithub.pullRequests.getCommits('lalala').foo === 'beep');\nassert(mockGithub.pullRequests.getCommits.callCount === 1);\n\n```\n\n## API\n\n### `doubleOhSeven()`\n\nTakes an object or function as an argument, returns a function or object matching the original, but with mocked out functions.\n\n### `mockFn.implementation`\n\nThe implementation of the mock function.\nSet with `=`:\n\nEx:\n```\nmockFn.implementation = function (val, cb) {\n  return cb(val + 1);\n};\n```\n\nThe following functions are helpers for implementation; using them will override `mockFn.implementation`.\n\n#### `mockFn.returns()`\n\nThe return value of the mock.\n\nEx:\n```\nmockFn.returns('foo');\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n#### `mockFn.callbackArgs()`\n\nThe callback args to be invoked by the mock.\n\nEx:\n```\nmockFn.callbackArgs(['foo']);\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n## License\nMIT\n","readmeFilename":"README.md","_id":"007@0.0.2","dist":{"shasum":"76e31a32eabbaafecd0929491d73ed9d728827f3","tarball":"https://registry.npmjs.org/007/-/007-0.0.2.tgz","integrity":"sha512-U6dR/Xt+Wc+l+PRdsyF6hNlPdBoj/jGPwxBXi1ek4DbQiidrdsa+y1MK//EE3LZqHIWO7lgu9rehb3+lkMqHJg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICMkP122h0GV9PyCzRP5UGz+jpYQhrmdqkBvH3iw/pawAiEAs28dVjTndlcWPGtluW4rzyZsHzNgvC5J8U53lNEGS08="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"btford","email":"briantford@gmail.com"},"maintainers":[{"name":"btford","email":"briantford@gmail.com"}]}},"readme":"# 007\n\nReturns a deep copy of an object with all functions converted to spies.\n\n## Install\n\nInstall with `npm`:\n\n```\nnpm install 007\n```\n\n## Example\n\n```\n// we want to test github\nvar github = require('github');\nvar doubleOhSeven = require('007');\nvar mockGithub = doubleOhSeven(github);\n\nmockGithub.pullRequests.getCommits.returns = function () {\n  return {\n    foo: 'beep'\n  };\n};\n\nassert(mockGithub.pullRequests.getCommits('lalala').foo === 'beep');\nassert(mockGithub.pullRequests.getCommits.callCount === 1);\n\n```\n\n## API\n\n### `doubleOhSeven()`\n\nTakes an object or function as an argument, returns a function or object matching the original, but with mocked out functions.\n\n### `mockFn.implementation`\n\nThe implementation of the mock function.\nSet with `=`:\n\nEx:\n```\nmockFn.implementation = function (val, cb) {\n  return cb(val + 1);\n};\n```\n\nThe following functions are helpers for implementation; using them will override `mockFn.implementation`.\n\n#### `mockFn.returns()`\n\nThe return value of the mock.\n\nEx:\n```\nmockFn.returns('foo');\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n#### `mockFn.callbackArgs`\n\nThe callback args to be invoked by the mock.\n\nEx:\n```\nmockFn.callbackArgs(['foo']);\nmockFn(function (arg) {\n  console.log(arg); // outputs 'foo'\n});\n```\n\n## License\nMIT\n","maintainers":[{"name":"btford","email":"briantford@gmail.com"}],"time":{"modified":"2022-06-12T14:04:57.619Z","created":"2013-07-26T19:46:09.787Z","0.0.0":"2013-07-26T19:46:10.853Z","0.0.1":"2013-07-26T23:12:55.671Z","0.0.2":"2013-07-29T18:57:38.092Z"},"author":{"name":"Brian Ford"},"repository":{"type":"git","url":"git://github.com/btford/007.git"}}