{"action":"created","issue":{"url":"https://api.github.com/repos/redux-saga/redux-saga/issues/877","repository_url":"https://api.github.com/repos/redux-saga/redux-saga","labels_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/877/labels{/name}","comments_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/877/comments","events_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/877/events","html_url":"https://github.com/redux-saga/redux-saga/pull/877","id":215538529,"number":877,"title":"Fixes #875","user":{"login":"baldwmic","id":10538297,"avatar_url":"https://avatars1.githubusercontent.com/u/10538297?v=3","gravatar_id":"","url":"https://api.github.com/users/baldwmic","html_url":"https://github.com/baldwmic","followers_url":"https://api.github.com/users/baldwmic/followers","following_url":"https://api.github.com/users/baldwmic/following{/other_user}","gists_url":"https://api.github.com/users/baldwmic/gists{/gist_id}","starred_url":"https://api.github.com/users/baldwmic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baldwmic/subscriptions","organizations_url":"https://api.github.com/users/baldwmic/orgs","repos_url":"https://api.github.com/users/baldwmic/repos","events_url":"https://api.github.com/users/baldwmic/events{/privacy}","received_events_url":"https://api.github.com/users/baldwmic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-03-20T20:02:30Z","updated_at":"2017-04-03T22:45:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/redux-saga/redux-saga/pulls/877","html_url":"https://github.com/redux-saga/redux-saga/pull/877","diff_url":"https://github.com/redux-saga/redux-saga/pull/877.diff","patch_url":"https://github.com/redux-saga/redux-saga/pull/877.patch"},"body":"### What the PR does\r\n- extracts `close` function into variable to ensure `unsubscribe` function gets called when `END` event is emitted.\r\n- updates advanced docs for channels to show that unsubscribe function will be called \r\n\r\n#### Note:\r\n- this is my first code PR for redux-saga, I'm not sure the best way to test this? I see the appropriate [test code here](https://github.com/redux-saga/redux-saga/blob/e237a20e6973585c44b5a098a688a4a3c102c033/test/channel.js#L195) but I'm used to using [Sinon](http://sinonjs.org/) to test that a function got called and I don't see that in this repo.\r\n- thanks to @Andarist for the help! 😄 "},"comment":{"url":"https://api.github.com/repos/redux-saga/redux-saga/issues/comments/291296070","html_url":"https://github.com/redux-saga/redux-saga/pull/877#issuecomment-291296070","issue_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/877","id":291296070,"user":{"login":"baldwmic","id":10538297,"avatar_url":"https://avatars1.githubusercontent.com/u/10538297?v=3","gravatar_id":"","url":"https://api.github.com/users/baldwmic","html_url":"https://github.com/baldwmic","followers_url":"https://api.github.com/users/baldwmic/followers","following_url":"https://api.github.com/users/baldwmic/following{/other_user}","gists_url":"https://api.github.com/users/baldwmic/gists{/gist_id}","starred_url":"https://api.github.com/users/baldwmic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baldwmic/subscriptions","organizations_url":"https://api.github.com/users/baldwmic/orgs","repos_url":"https://api.github.com/users/baldwmic/repos","events_url":"https://api.github.com/users/baldwmic/events{/privacy}","received_events_url":"https://api.github.com/users/baldwmic/received_events","type":"User","site_admin":false},"created_at":"2017-04-03T22:45:42Z","updated_at":"2017-04-03T22:45:42Z","body":"Ok @Andarist I've made the suggested changes. I even added a [test case here](https://github.com/redux-saga/redux-saga/pull/877/files#diff-ec2106b885fcd06fe9f0a0ff69c86d41R237) for the eventChannel defined in the docs [here](https://github.com/redux-saga/redux-saga/blob/37f519ca1ab4041e7b571d7e172705ff307c1029/docs/advanced/Channels.md#using-the-eventchannel-factory-to-connect-to-external-events).\r\n\r\nThe one odd part is that I'm using a setTimeout in the test since the eventChannel uses a setInterval. Is there a better way to do this in mocha?"}}
{"actor":{"display_login":"baldwmic"}}