{"action":"created","issue":{"url":"https://api.github.com/repos/domenic/chai-as-promised/issues/116","labels_url":"https://api.github.com/repos/domenic/chai-as-promised/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/domenic/chai-as-promised/issues/116/comments","events_url":"https://api.github.com/repos/domenic/chai-as-promised/issues/116/events","html_url":"https://github.com/domenic/chai-as-promised/issues/116","id":95921219,"number":116,"title":"`return` is required for promise assertions","user":{"login":"btbonval","id":880439,"avatar_url":"https://avatars.githubusercontent.com/u/880439?v=3","gravatar_id":"","url":"https://api.github.com/users/btbonval","html_url":"https://github.com/btbonval","followers_url":"https://api.github.com/users/btbonval/followers","following_url":"https://api.github.com/users/btbonval/following{/other_user}","gists_url":"https://api.github.com/users/btbonval/gists{/gist_id}","starred_url":"https://api.github.com/users/btbonval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btbonval/subscriptions","organizations_url":"https://api.github.com/users/btbonval/orgs","repos_url":"https://api.github.com/users/btbonval/repos","events_url":"https://api.github.com/users/btbonval/events{/privacy}","received_events_url":"https://api.github.com/users/btbonval/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-19T14:43:19Z","updated_at":"2015-08-16T20:17:12Z","closed_at":null,"body":"I just found out all of my promise-based assertions were incorrect because I was not returning them. Without returning them, no assertions are raised. For example, this code will always pass no matter what is returned into `promise` (even a `reject()`) so long as it is thenable:\r\n\r\n``` javascript\r\n  it('returns data via promise without modification', function() {\r\n    var promise = cdbfuncs.fetchDocs(mock_http, urlFixture);\r\n    expect(promise).to.eventually.deep.equal(dl_data);\r\n  });\r\n```\r\n\r\nIt took me a close reading of the README to realize the `return` used in nearly every example was there (there are some without it). Since the examples were without context, it wasn't clear the `return` was necessary or an artifact of the example's context.\r\n\r\n``` javascript\r\nit('returns data via promise without modification', function() {\r\n    var promise = cdbfuncs.fetchDocs(mock_http, urlFixture);\r\n    return expect(promise).to.eventually.deep.equal(dl_data);\r\n  });\r\n```\r\n\r\nMy team has been building multiple assertions inside a single `it()`. I had decided to restructure my code for one assertions per `it()` by sheer coincidence. While Chai assertions can be bundled together line-by-line in a single `it()`, Chai-as-Promised can only support a single assertion per `it()`.\r\n\r\nI'm fine with this workflow. However, it might be beneficial to explain this explicitly in fairly big lettering in the README. Something along the lines of \"Each assertion of Chai-as-Promised must be returned or it will give erroneous results. The recommended workflow is a single assertion per `it()`.\"."},"comment":{"url":"https://api.github.com/repos/domenic/chai-as-promised/issues/comments/131617520","html_url":"https://github.com/domenic/chai-as-promised/issues/116#issuecomment-131617520","issue_url":"https://api.github.com/repos/domenic/chai-as-promised/issues/116","id":131617520,"user":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"created_at":"2015-08-16T20:17:12Z","updated_at":"2015-08-16T20:17:12Z","body":"@TimeForAChange if you'd like to write some documentation to clarify this, and put it in a PR, it'd be very welcome :smile: "}}