{"action":"created","comment":{"url":"https://api.github.com/repos/chenglou/react-motion/pulls/comments/36136482","id":36136482,"diff_hunk":"@@ -167,26 +258,64 @@ describe('Spring', () => {\n       },\n     });\n     TestUtils.renderIntoDocument(<App />);\n+\n+    // Initial render\n+    expect(count).toEqual([0]);\n+    mockRaf.manySteps(8);\n+    expect(count).toEqual([\n+      0,","path":"test/Spring-test.js","position":296,"original_position":296,"commit_id":"994b70be9f24e564a33ddec9b2451c7b71b865fc","original_commit_id":"994b70be9f24e564a33ddec9b2451c7b71b865fc","user":{"login":"nkbt","id":175264,"avatar_url":"https://avatars.githubusercontent.com/u/175264?v=3","gravatar_id":"","url":"https://api.github.com/users/nkbt","html_url":"https://github.com/nkbt","followers_url":"https://api.github.com/users/nkbt/followers","following_url":"https://api.github.com/users/nkbt/following{/other_user}","gists_url":"https://api.github.com/users/nkbt/gists{/gist_id}","starred_url":"https://api.github.com/users/nkbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkbt/subscriptions","organizations_url":"https://api.github.com/users/nkbt/orgs","repos_url":"https://api.github.com/users/nkbt/repos","events_url":"https://api.github.com/users/nkbt/events{/privacy}","received_events_url":"https://api.github.com/users/nkbt/received_events","type":"User","site_admin":false},"body":"I'd stick to one list and put it to the top of the file as const (it is always the same with 8 steps and from 0 to 10)","created_at":"2015-08-03T21:56:42Z","updated_at":"2015-08-03T21:56:42Z","html_url":"https://github.com/chenglou/react-motion/pull/115#discussion_r36136482","pull_request_url":"https://api.github.com/repos/chenglou/react-motion/pulls/115","_links":{"self":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/comments/36136482"},"html":{"href":"https://github.com/chenglou/react-motion/pull/115#discussion_r36136482"},"pull_request":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/115"}}},"pull_request":{"url":"https://api.github.com/repos/chenglou/react-motion/pulls/115","id":41513658,"html_url":"https://github.com/chenglou/react-motion/pull/115","diff_url":"https://github.com/chenglou/react-motion/pull/115.diff","patch_url":"https://github.com/chenglou/react-motion/pull/115.patch","issue_url":"https://api.github.com/repos/chenglou/react-motion/issues/115","number":115,"state":"open","locked":false,"title":"Add mockRaf (combining mocks for `raf` and `performance-now`)","user":{"login":"bsansouci","id":4534692,"avatar_url":"https://avatars.githubusercontent.com/u/4534692?v=3","gravatar_id":"","url":"https://api.github.com/users/bsansouci","html_url":"https://github.com/bsansouci","followers_url":"https://api.github.com/users/bsansouci/followers","following_url":"https://api.github.com/users/bsansouci/following{/other_user}","gists_url":"https://api.github.com/users/bsansouci/gists{/gist_id}","starred_url":"https://api.github.com/users/bsansouci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsansouci/subscriptions","organizations_url":"https://api.github.com/users/bsansouci/orgs","repos_url":"https://api.github.com/users/bsansouci/repos","events_url":"https://api.github.com/users/bsansouci/events{/privacy}","received_events_url":"https://api.github.com/users/bsansouci/received_events","type":"User","site_admin":false},"body":"The title says it all.\r\n\r\nI also adapted the tests to use that mock `raf`. The main advantages of using a mock `raf` is that the tests become synchronous, making them much easier to reason about. They also make the whole system deterministic. This means that when we call `mockRaf.step()` 10 times with the same Spring (and same constants),  `currValue` will always take the same values in the same order.\r\n\r\nThere are two main functions that can be used:\r\n- `mockRaf.step(ms = 16)` - will step \"time\" by one frame and by `ms` amount of milliseconds. This will call all `raf`s that were registered in the last frame.\r\n- `mockRaf.manySteps(numberOfSteps = 1)` - will call `mockRaf.step` `numberOfSteps` times\r\n\r\nThe two other functions are the mock functions. They can be used like follow:\r\n```js\r\nconst injector = require('inject!../src/components');\r\nconst injectorAnimationLoop = require('inject!../src/animationLoop');\r\nconst {Spring, TransitionSpring} = injector({\r\n  './animationLoop': injectorAnimationLoop({\r\n    raf: mockRaf.getRaf(), // Will return a raf function that will just queue the callback\r\n    'performance-now': mockRaf.getNow(), // Will return a now() function\r\n  }),\r\n})(React);\r\n```","created_at":"2015-08-03T21:48:35Z","updated_at":"2015-08-03T21:56:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9186de8e470a204f017bb243012a4cda91f27d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chenglou/react-motion/pulls/115/commits","review_comments_url":"https://api.github.com/repos/chenglou/react-motion/pulls/115/comments","review_comment_url":"https://api.github.com/repos/chenglou/react-motion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chenglou/react-motion/issues/115/comments","statuses_url":"https://api.github.com/repos/chenglou/react-motion/statuses/994b70be9f24e564a33ddec9b2451c7b71b865fc","head":{"label":"bsansouci:tests","ref":"tests","sha":"994b70be9f24e564a33ddec9b2451c7b71b865fc","user":{"login":"bsansouci","id":4534692,"avatar_url":"https://avatars.githubusercontent.com/u/4534692?v=3","gravatar_id":"","url":"https://api.github.com/users/bsansouci","html_url":"https://github.com/bsansouci","followers_url":"https://api.github.com/users/bsansouci/followers","following_url":"https://api.github.com/users/bsansouci/following{/other_user}","gists_url":"https://api.github.com/users/bsansouci/gists{/gist_id}","starred_url":"https://api.github.com/users/bsansouci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsansouci/subscriptions","organizations_url":"https://api.github.com/users/bsansouci/orgs","repos_url":"https://api.github.com/users/bsansouci/repos","events_url":"https://api.github.com/users/bsansouci/events{/privacy}","received_events_url":"https://api.github.com/users/bsansouci/received_events","type":"User","site_admin":false},"repo":{"id":39280974,"name":"react-motion","full_name":"bsansouci/react-motion","owner":{"login":"bsansouci","id":4534692,"avatar_url":"https://avatars.githubusercontent.com/u/4534692?v=3","gravatar_id":"","url":"https://api.github.com/users/bsansouci","html_url":"https://github.com/bsansouci","followers_url":"https://api.github.com/users/bsansouci/followers","following_url":"https://api.github.com/users/bsansouci/following{/other_user}","gists_url":"https://api.github.com/users/bsansouci/gists{/gist_id}","starred_url":"https://api.github.com/users/bsansouci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsansouci/subscriptions","organizations_url":"https://api.github.com/users/bsansouci/orgs","repos_url":"https://api.github.com/users/bsansouci/repos","events_url":"https://api.github.com/users/bsansouci/events{/privacy}","received_events_url":"https://api.github.com/users/bsansouci/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bsansouci/react-motion","description":"A spring that solves your animation problems.","fork":true,"url":"https://api.github.com/repos/bsansouci/react-motion","forks_url":"https://api.github.com/repos/bsansouci/react-motion/forks","keys_url":"https://api.github.com/repos/bsansouci/react-motion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsansouci/react-motion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsansouci/react-motion/teams","hooks_url":"https://api.github.com/repos/bsansouci/react-motion/hooks","issue_events_url":"https://api.github.com/repos/bsansouci/react-motion/issues/events{/number}","events_url":"https://api.github.com/repos/bsansouci/react-motion/events","assignees_url":"https://api.github.com/repos/bsansouci/react-motion/assignees{/user}","branches_url":"https://api.github.com/repos/bsansouci/react-motion/branches{/branch}","tags_url":"https://api.github.com/repos/bsansouci/react-motion/tags","blobs_url":"https://api.github.com/repos/bsansouci/react-motion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsansouci/react-motion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsansouci/react-motion/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsansouci/react-motion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsansouci/react-motion/statuses/{sha}","languages_url":"https://api.github.com/repos/bsansouci/react-motion/languages","stargazers_url":"https://api.github.com/repos/bsansouci/react-motion/stargazers","contributors_url":"https://api.github.com/repos/bsansouci/react-motion/contributors","subscribers_url":"https://api.github.com/repos/bsansouci/react-motion/subscribers","subscription_url":"https://api.github.com/repos/bsansouci/react-motion/subscription","commits_url":"https://api.github.com/repos/bsansouci/react-motion/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsansouci/react-motion/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsansouci/react-motion/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsansouci/react-motion/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsansouci/react-motion/contents/{+path}","compare_url":"https://api.github.com/repos/bsansouci/react-motion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsansouci/react-motion/merges","archive_url":"https://api.github.com/repos/bsansouci/react-motion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsansouci/react-motion/downloads","issues_url":"https://api.github.com/repos/bsansouci/react-motion/issues{/number}","pulls_url":"https://api.github.com/repos/bsansouci/react-motion/pulls{/number}","milestones_url":"https://api.github.com/repos/bsansouci/react-motion/milestones{/number}","notifications_url":"https://api.github.com/repos/bsansouci/react-motion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsansouci/react-motion/labels{/name}","releases_url":"https://api.github.com/repos/bsansouci/react-motion/releases{/id}","created_at":"2015-07-18T00:26:57Z","updated_at":"2015-07-18T00:26:58Z","pushed_at":"2015-08-03T21:39:17Z","git_url":"git://github.com/bsansouci/react-motion.git","ssh_url":"git@github.com:bsansouci/react-motion.git","clone_url":"https://github.com/bsansouci/react-motion.git","svn_url":"https://github.com/bsansouci/react-motion","homepage":"","size":1433,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chenglou:master","ref":"master","sha":"2a7bec5286f3fc816f3fa51f8e52784073d88e04","user":{"login":"chenglou","id":1909539,"avatar_url":"https://avatars.githubusercontent.com/u/1909539?v=3","gravatar_id":"","url":"https://api.github.com/users/chenglou","html_url":"https://github.com/chenglou","followers_url":"https://api.github.com/users/chenglou/followers","following_url":"https://api.github.com/users/chenglou/following{/other_user}","gists_url":"https://api.github.com/users/chenglou/gists{/gist_id}","starred_url":"https://api.github.com/users/chenglou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenglou/subscriptions","organizations_url":"https://api.github.com/users/chenglou/orgs","repos_url":"https://api.github.com/users/chenglou/repos","events_url":"https://api.github.com/users/chenglou/events{/privacy}","received_events_url":"https://api.github.com/users/chenglou/received_events","type":"User","site_admin":false},"repo":{"id":37246537,"name":"react-motion","full_name":"chenglou/react-motion","owner":{"login":"chenglou","id":1909539,"avatar_url":"https://avatars.githubusercontent.com/u/1909539?v=3","gravatar_id":"","url":"https://api.github.com/users/chenglou","html_url":"https://github.com/chenglou","followers_url":"https://api.github.com/users/chenglou/followers","following_url":"https://api.github.com/users/chenglou/following{/other_user}","gists_url":"https://api.github.com/users/chenglou/gists{/gist_id}","starred_url":"https://api.github.com/users/chenglou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenglou/subscriptions","organizations_url":"https://api.github.com/users/chenglou/orgs","repos_url":"https://api.github.com/users/chenglou/repos","events_url":"https://api.github.com/users/chenglou/events{/privacy}","received_events_url":"https://api.github.com/users/chenglou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chenglou/react-motion","description":"A spring that solves your animation problems.","fork":false,"url":"https://api.github.com/repos/chenglou/react-motion","forks_url":"https://api.github.com/repos/chenglou/react-motion/forks","keys_url":"https://api.github.com/repos/chenglou/react-motion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chenglou/react-motion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chenglou/react-motion/teams","hooks_url":"https://api.github.com/repos/chenglou/react-motion/hooks","issue_events_url":"https://api.github.com/repos/chenglou/react-motion/issues/events{/number}","events_url":"https://api.github.com/repos/chenglou/react-motion/events","assignees_url":"https://api.github.com/repos/chenglou/react-motion/assignees{/user}","branches_url":"https://api.github.com/repos/chenglou/react-motion/branches{/branch}","tags_url":"https://api.github.com/repos/chenglou/react-motion/tags","blobs_url":"https://api.github.com/repos/chenglou/react-motion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chenglou/react-motion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chenglou/react-motion/git/refs{/sha}","trees_url":"https://api.github.com/repos/chenglou/react-motion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chenglou/react-motion/statuses/{sha}","languages_url":"https://api.github.com/repos/chenglou/react-motion/languages","stargazers_url":"https://api.github.com/repos/chenglou/react-motion/stargazers","contributors_url":"https://api.github.com/repos/chenglou/react-motion/contributors","subscribers_url":"https://api.github.com/repos/chenglou/react-motion/subscribers","subscription_url":"https://api.github.com/repos/chenglou/react-motion/subscription","commits_url":"https://api.github.com/repos/chenglou/react-motion/commits{/sha}","git_commits_url":"https://api.github.com/repos/chenglou/react-motion/git/commits{/sha}","comments_url":"https://api.github.com/repos/chenglou/react-motion/comments{/number}","issue_comment_url":"https://api.github.com/repos/chenglou/react-motion/issues/comments{/number}","contents_url":"https://api.github.com/repos/chenglou/react-motion/contents/{+path}","compare_url":"https://api.github.com/repos/chenglou/react-motion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chenglou/react-motion/merges","archive_url":"https://api.github.com/repos/chenglou/react-motion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chenglou/react-motion/downloads","issues_url":"https://api.github.com/repos/chenglou/react-motion/issues{/number}","pulls_url":"https://api.github.com/repos/chenglou/react-motion/pulls{/number}","milestones_url":"https://api.github.com/repos/chenglou/react-motion/milestones{/number}","notifications_url":"https://api.github.com/repos/chenglou/react-motion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chenglou/react-motion/labels{/name}","releases_url":"https://api.github.com/repos/chenglou/react-motion/releases{/id}","created_at":"2015-06-11T07:38:23Z","updated_at":"2015-08-03T21:51:14Z","pushed_at":"2015-08-03T21:55:16Z","git_url":"git://github.com/chenglou/react-motion.git","ssh_url":"git@github.com:chenglou/react-motion.git","clone_url":"https://github.com/chenglou/react-motion.git","svn_url":"https://github.com/chenglou/react-motion","homepage":"","size":2416,"stargazers_count":1389,"watchers_count":1389,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":22,"forks":57,"open_issues":22,"watchers":1389,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/115"},"html":{"href":"https://github.com/chenglou/react-motion/pull/115"},"issue":{"href":"https://api.github.com/repos/chenglou/react-motion/issues/115"},"comments":{"href":"https://api.github.com/repos/chenglou/react-motion/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chenglou/react-motion/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/chenglou/react-motion/statuses/994b70be9f24e564a33ddec9b2451c7b71b865fc"}}}}