{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/3701","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/3701/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/3701/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/3701/events","html_url":"https://github.com/ReactiveX/rxjs/pull/3701","id":323626873,"number":3701,"title":"WIP: add test sample with zone-testing","user":{"login":"JiaLiPassion","id":1442575,"avatar_url":"https://avatars3.githubusercontent.com/u/1442575?v=4","gravatar_id":"","url":"https://api.github.com/users/JiaLiPassion","html_url":"https://github.com/JiaLiPassion","followers_url":"https://api.github.com/users/JiaLiPassion/followers","following_url":"https://api.github.com/users/JiaLiPassion/following{/other_user}","gists_url":"https://api.github.com/users/JiaLiPassion/gists{/gist_id}","starred_url":"https://api.github.com/users/JiaLiPassion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiaLiPassion/subscriptions","organizations_url":"https://api.github.com/users/JiaLiPassion/orgs","repos_url":"https://api.github.com/users/JiaLiPassion/repos","events_url":"https://api.github.com/users/JiaLiPassion/events{/privacy}","received_events_url":"https://api.github.com/users/JiaLiPassion/received_events","type":"User","site_admin":false},"labels":[{"id":241316858,"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/PR:%20blocked","name":"PR: blocked","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-16T13:42:51Z","updated_at":"2018-05-21T02:37:35Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/3701","html_url":"https://github.com/ReactiveX/rxjs/pull/3701","diff_url":"https://github.com/ReactiveX/rxjs/pull/3701.diff","patch_url":"https://github.com/ReactiveX/rxjs/pull/3701.patch"},"body":"<!--\r\nThank you very much for your pull request!\r\n\r\nIf your PR is the addition of a new operator, please make sure all these boxes are ticked with an x:\r\n\r\n- [ ] Add the operator to Rx\r\n- [ ] It must have a `-spec.ts` tests file covering the canonical corner cases, with marble diagram tests\r\n- [ ] If possible, write a `asDiagram` test case too, for PNG diagram generation purposes\r\n- [ ] The spec file should have a type definition test at the end of the spec to verify type definition for various use cases\r\n- [ ] The operator must be documented in JSDoc style in the implementation file, including also the PNG marble diagram image\r\n- [ ] The operator should be listed in `doc/operators.md` in a category of operators\r\n- [ ] The operator should also be documented. See [Documentation Guidelines](../CONTRIBUTING.md).\r\n- [ ] It should also be inserted in the operator decision tree file `doc/decision-tree-widget/tree.yml`\r\n- [ ] You may need to update `MIGRATION.md` if the operator differs from the corresponding one in RxJS v4\r\n-->\r\n\r\n**Description:**\r\n\r\nThis PR is based on @benlesh 's document here. https://docs.google.com/document/d/1sIUgRVRgcsLcC8B5sbCAPDvA_lrYcACzh9Q80vxFTbw/\r\n\r\nThis is a experimental PR to try to let `rxjs` test with `zone-testing`, this PR will use the experimental version of `zone.js` (https://github.com/angular/zone.js/pull/1084) .  So with adding more test cases, we will find more use cases and find out current `zone-testing` APIs satisfy the `rxjs` requirements or not. \r\n\r\n### Current status:\r\n\r\n1. add `zone-testing` fakeAsync test cases for `combineLatest`, use `setInterval` to create `Observable`, those `async` test cases was originally handled by `TestScheduler`.\r\n\r\n```javascript\r\nfunction createIntervalObservable(interval: number) {\r\n  return new Observable<number>(subscriber => {\r\n    let i = 0;\r\n    const id = setInterval(() => {\r\n      subscriber.next(i++);\r\n    }, interval);\r\n    return () => clearInterval(id);\r\n  });\r\n}\r\n\r\nit('should combine the latest values of multiple observables with fakeAsync', fakeAsyncTest(() => {\r\n    const results: any[] = [];\r\n    const s1 = createIntervalObservable(1000);\r\n    const s2 = createIntervalObservable(1500);\r\n    const s3 = createIntervalObservable(1800);\r\n    combineLatest(s1, s2, s3).subscribe({\r\n      next(value) { results.push(value); },\r\n      complete() { results.push('done'); },\r\n    });\r\n    expect(results).toEqual([]);\r\n    tick(1000);\r\n    expect(results).toEqual([]);\r\n    tick(500);\r\n    expect(results).toEqual([]);\r\n    tick(300);\r\n    expect(results).toEqual([[0, 0, 0]]);\r\n    tick(300);\r\n    expect(results).toEqual([[0, 0, 0], [1, 0, 0]]);\r\n    clearAllMacrotasks();\r\n  }));\r\n```\r\n2. TODO: try to add `marble test` sample with `zone-testing` later. \r\n\r\n**Related issue (if exists):**\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/390537763","html_url":"https://github.com/ReactiveX/rxjs/pull/3701#issuecomment-390537763","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/3701","id":390537763,"user":{"login":"JiaLiPassion","id":1442575,"avatar_url":"https://avatars3.githubusercontent.com/u/1442575?v=4","gravatar_id":"","url":"https://api.github.com/users/JiaLiPassion","html_url":"https://github.com/JiaLiPassion","followers_url":"https://api.github.com/users/JiaLiPassion/followers","following_url":"https://api.github.com/users/JiaLiPassion/following{/other_user}","gists_url":"https://api.github.com/users/JiaLiPassion/gists{/gist_id}","starred_url":"https://api.github.com/users/JiaLiPassion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiaLiPassion/subscriptions","organizations_url":"https://api.github.com/users/JiaLiPassion/orgs","repos_url":"https://api.github.com/users/JiaLiPassion/repos","events_url":"https://api.github.com/users/JiaLiPassion/events{/privacy}","received_events_url":"https://api.github.com/users/JiaLiPassion/received_events","type":"User","site_admin":false},"created_at":"2018-05-21T02:37:35Z","updated_at":"2018-05-21T02:37:35Z","author_association":"NONE","body":"@benlesh, thanks, I just use this PR as a discussion place, so we can discuss whether `zone-testing` can satisfy `rxjs` requirement or not.\r\n\r\n> We're likely to have to change a few things to accommodate the fact that async/await cannot be hooked ala zones.\r\n\r\nin `nodejs` with `asynchooks`, we can hooks with `zone`, here I created a POC PR, https://github.com/angular/zone.js/pull/795"}}
{"actor":{"display_login":"JiaLiPassion"}}