{"action":"closed","issue":{"url":"https://api.github.com/repos/chaijs/chai-http/issues/119","repository_url":"https://api.github.com/repos/chaijs/chai-http","labels_url":"https://api.github.com/repos/chaijs/chai-http/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/chaijs/chai-http/issues/119/comments","events_url":"https://api.github.com/repos/chaijs/chai-http/issues/119/events","html_url":"https://github.com/chaijs/chai-http/issues/119","id":185772043,"number":119,"title":"Documentation on Promises is not clear enough OR a better Error message is required","user":{"login":"jonniedarko","id":3673943,"avatar_url":"https://avatars.githubusercontent.com/u/3673943?v=3","gravatar_id":"","url":"https://api.github.com/users/jonniedarko","html_url":"https://github.com/jonniedarko","followers_url":"https://api.github.com/users/jonniedarko/followers","following_url":"https://api.github.com/users/jonniedarko/following{/other_user}","gists_url":"https://api.github.com/users/jonniedarko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonniedarko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonniedarko/subscriptions","organizations_url":"https://api.github.com/users/jonniedarko/orgs","repos_url":"https://api.github.com/users/jonniedarko/repos","events_url":"https://api.github.com/users/jonniedarko/events{/privacy}","received_events_url":"https://api.github.com/users/jonniedarko/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-27T20:29:19Z","updated_at":"2016-10-27T20:46:24Z","closed_at":"2016-10-27T20:46:24Z","body":"It may seem obvious to others but I spent a while trying to figure out promises because they are not compatible with `done`\r\n\r\nmy original test looked like this:\r\n```js\r\nit('it should be able to Create a new User', (done) => {\r\n        chai.request(server)\r\n            .post('/api/users')\r\n            .send({email:'a@b.c', password:'abc123'})\r\n            .then((err, res) => {\r\n                console.log(res);\r\n                res.should.have.status(200);\r\n                res.text.should.be.eq('You must send the username and the password');\r\n              done();\r\n            })\r\n            .catch(done);\r\n      });\r\n```\r\n\r\nbut I kept getting the error\r\n```\r\nError: Bad Request\r\n      at Test.Request.callback (node_modules/superagent/lib/node/index.js:626:17)\r\n      at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:795:18)\r\n      at endReadableNT (_stream_readable.js:974:12)\r\n      at _combinedTickCallback (internal/process/next_tick.js:74:11)\r\n      at process._tickCallback (internal/process/next_tick.js:98:9)\r\n```\r\n\r\nWhen I removed the done, the test passed \r\n\r\n```js\r\nit('it should be able to Create a new User', () => {\r\n        chai.request(server)\r\n            .post('/api/users')\r\n            .send({email:'a@b.c', password:'abc123'})\r\n            .then((err, res) => {\r\n                console.log(res);\r\n                res.should.have.status(200);\r\n                res.text.should.be.eq('User Created');\r\n            })\r\n            .catch((err) => {\r\n                throw err\r\n          });\r\n      });\r\n```\r\n\r\n"}}
{"actor":{"display_login":"jonniedarko"}}