{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/knex/issues/1519","repository_url":"https://api.github.com/repos/tgriesser/knex","labels_url":"https://api.github.com/repos/tgriesser/knex/issues/1519/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/knex/issues/1519/comments","events_url":"https://api.github.com/repos/tgriesser/knex/issues/1519/events","html_url":"https://github.com/tgriesser/knex/issues/1519","id":161172074,"number":1519,"title":"Properly unit testing the failure","user":{"login":"Caligone","id":957477,"avatar_url":"https://avatars.githubusercontent.com/u/957477?v=3","gravatar_id":"","url":"https://api.github.com/users/Caligone","html_url":"https://github.com/Caligone","followers_url":"https://api.github.com/users/Caligone/followers","following_url":"https://api.github.com/users/Caligone/following{/other_user}","gists_url":"https://api.github.com/users/Caligone/gists{/gist_id}","starred_url":"https://api.github.com/users/Caligone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caligone/subscriptions","organizations_url":"https://api.github.com/users/Caligone/orgs","repos_url":"https://api.github.com/users/Caligone/repos","events_url":"https://api.github.com/users/Caligone/events{/privacy}","received_events_url":"https://api.github.com/users/Caligone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-20T11:16:24Z","updated_at":"2016-09-13T14:12:42Z","closed_at":null,"body":"I am trying to test my catch handler in a piece of code :\r\n```js\r\nclass User {\r\n  actionsOnDB () {\r\n    this.knex('users')\r\n      .create()\r\n      .then( () => {\r\n        console.log('Done');\r\n      })\r\n      .catch( (err) => {\r\n        console.log('Error');\r\n      })\r\n  }\r\n}\r\n```\r\n\r\nI am using Sinon with something like :\r\n```js\r\nSinon.stub(user.knex, 'create').returns(Promise.reject('Test Error'));\r\n```\r\n\r\nBut I never get into my `catch`.\r\n\r\nIs there a proper way to test that kind of things?\r\nThanks"},"comment":{"url":"https://api.github.com/repos/tgriesser/knex/issues/comments/246694359","html_url":"https://github.com/tgriesser/knex/issues/1519#issuecomment-246694359","issue_url":"https://api.github.com/repos/tgriesser/knex/issues/1519","id":246694359,"user":{"login":"Caligone","id":957477,"avatar_url":"https://avatars.githubusercontent.com/u/957477?v=3","gravatar_id":"","url":"https://api.github.com/users/Caligone","html_url":"https://github.com/Caligone","followers_url":"https://api.github.com/users/Caligone/followers","following_url":"https://api.github.com/users/Caligone/following{/other_user}","gists_url":"https://api.github.com/users/Caligone/gists{/gist_id}","starred_url":"https://api.github.com/users/Caligone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Caligone/subscriptions","organizations_url":"https://api.github.com/users/Caligone/orgs","repos_url":"https://api.github.com/users/Caligone/repos","events_url":"https://api.github.com/users/Caligone/events{/privacy}","received_events_url":"https://api.github.com/users/Caligone/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T14:12:42Z","updated_at":"2016-09-13T14:12:42Z","body":"@afgallo Sorry, I don't"}}
{"actor":{"display_login":"Caligone"}}