{"action":"created","issue":{"url":"https://api.github.com/repos/thlorenz/proxyquire/issues/119","repository_url":"https://api.github.com/repos/thlorenz/proxyquire","labels_url":"https://api.github.com/repos/thlorenz/proxyquire/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/thlorenz/proxyquire/issues/119/comments","events_url":"https://api.github.com/repos/thlorenz/proxyquire/issues/119/events","html_url":"https://github.com/thlorenz/proxyquire/issues/119","id":149892807,"number":119,"title":"Not replacing const, require nor let.","user":{"login":"nschurmann","id":5099344,"avatar_url":"https://avatars.githubusercontent.com/u/5099344?v=3","gravatar_id":"","url":"https://api.github.com/users/nschurmann","html_url":"https://github.com/nschurmann","followers_url":"https://api.github.com/users/nschurmann/followers","following_url":"https://api.github.com/users/nschurmann/following{/other_user}","gists_url":"https://api.github.com/users/nschurmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nschurmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nschurmann/subscriptions","organizations_url":"https://api.github.com/users/nschurmann/orgs","repos_url":"https://api.github.com/users/nschurmann/repos","events_url":"https://api.github.com/users/nschurmann/events{/privacy}","received_events_url":"https://api.github.com/users/nschurmann/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-20T21:34:49Z","updated_at":"2016-04-21T15:54:04Z","closed_at":"2016-04-21T15:51:30Z","body":"This is my code:\r\n\r\n```javascript\r\n\"use strict\";\r\nconst schema_1 = require(\"../schema\");\r\nconst dn = require(\"../lib/dn-helpers\");\r\nconst u = require(\"../lib/utils\");\r\nconst uuid = require('node-uuid');\r\n\r\nexports.getBrand = (db, id) => {\r\n    console.log('dn', dn);\r\n    return dn.sGetH(db, schema_1.Brands, id);\r\n};\r\n```\r\n\r\nand this is the test:\r\n```javascript\r\nconst assert = require(\"assert\")\r\nconst sinon = require(\"sinon\")\r\nconst proxyquire = require(\"proxyquire\")\r\n\r\ndescribe(\"Brand\", () => {\r\n  describe(\"func: getBrand\", () => {\r\n    var spy, dnStub, brand\r\n    \r\n    it(\"calls simple get by hash `sGetH`\", () => {\r\n      spy = sinon.spy()\r\n      dnStub = { sGetH: spy }\r\n      brand = proxyquire(\r\n        \"../../modules/brand\", { 'dn': dnStub, 'schema_1': { 'Brands': \"brandsData\" } })\r\n      brand.getBrand({}, \"hashedid\")\r\n    })\r\n  })\r\n})\r\n```\r\n\r\nThe `console.log` prints out the content of the library instead of replacing it.\r\nAlso tried with `../lib/dn-helpers` with no result."},"comment":{"url":"https://api.github.com/repos/thlorenz/proxyquire/issues/comments/212984426","html_url":"https://github.com/thlorenz/proxyquire/issues/119#issuecomment-212984426","issue_url":"https://api.github.com/repos/thlorenz/proxyquire/issues/119","id":212984426,"user":{"login":"nschurmann","id":5099344,"avatar_url":"https://avatars.githubusercontent.com/u/5099344?v=3","gravatar_id":"","url":"https://api.github.com/users/nschurmann","html_url":"https://github.com/nschurmann","followers_url":"https://api.github.com/users/nschurmann/followers","following_url":"https://api.github.com/users/nschurmann/following{/other_user}","gists_url":"https://api.github.com/users/nschurmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nschurmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nschurmann/subscriptions","organizations_url":"https://api.github.com/users/nschurmann/orgs","repos_url":"https://api.github.com/users/nschurmann/repos","events_url":"https://api.github.com/users/nschurmann/events{/privacy}","received_events_url":"https://api.github.com/users/nschurmann/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T15:54:04Z","updated_at":"2016-04-21T15:54:04Z","body":"@bendrucker so, if i write a test for a function, then i write another test for another function that calls the prior function, is bad to change it to a spy and test that the function was called? Testing an existing function more than once is a bad practice, it may make your tests pass or fail in unwanted scenarios.\r\n\r\nWhat is your approach in this scenario?"}}