{"action":"created","comment":{"url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/comments/152802028","pull_request_review_id":78717898,"id":152802028,"diff_hunk":"@@ -32,106 +32,145 @@ const graphData = {\n };\n \n test('should render as g', () => {\n-  const graph = shallow(<Graph graph={graphData} />);\n-  expect(graph.type()).toEqual('g');\n+  const graphWrapper = shallow(<Graph graph={graph} />);\n+  expect(graphWrapper.type()).toEqual('g');\n });\n \n test('should have specified class name', () => {\n-  const graph = shallow(<Graph graph={graphData} />);\n-  expect(graph.hasClass('root')).toBeTruthy();\n+  const graphWrapper = shallow(<Graph graph={graph} />);\n+  expect(graphWrapper.hasClass('root')).toBeTruthy();\n });\n \n describe('componentDidMount', () => {\n-  let graph;\n+  let graphWrapper;\n   let root;\n   let onSimulationEnd;\n-  const buffer = {};\n+  let instance;\n \n   beforeEach(() => {\n-    buffer.add = EntitiesCollection.prototype.add;\n+    jest.spyOn(TrafficRunner.prototype, 'tick');\n+    jest.spyOn(TrafficRunner, 'getLoops');\n+    jest.spyOn(EntitiesCollection.prototype, 'add');\n+    jest.spyOn(TrafficRunner, 'getLoops');\n     EntitiesCollection.prototype.add = jest.fn();\n-    buffer.getLoops = TrafficRunner.getLoops;\n-    buffer.tick = TrafficRunner.prototype.tick;\n     TrafficRunner.prototype.tick = jest.fn();\n     TrafficRunner.getLoops = jest.fn();\n     onSimulationEnd = jest.fn();\n     root = {\n       classed: jest.fn(),\n     };\n-    graph = shallow(<Graph graph={graphData} onSimulationEnd={onSimulationEnd} />);\n-    graph.instance().root = root;\n-    graph.instance().componentDidMount();\n+    graphWrapper = shallow(<Graph graph={graph} onSimulationEnd={onSimulationEnd} />);\n+    instance = graphWrapper.instance();\n+    instance.root = root;\n+    instance.simulate = jest.fn();\n   });\n \n   afterEach(() => {\n-    TrafficRunner.getLoops = buffer.getLoops;\n-    TrafficRunner.prototype.tick = buffer.tick;\n+    jest.restoreAllMocks();\n   });\n \n-  test('should set true to root element ', () => {\n+  test('should add simulation class to root element', () => {\n+    instance.componentDidMount();\n     expect(root.classed).toHaveBeenCalledWith('simulation', true);\n   });\n \n-  test('should set false to root element', () => {\n-    graph.instance().simulate();\n+  test('should remove simulation class to root element', async () => {\n+    await instance.componentDidMount();\n     expect(root.classed).toHaveBeenCalledWith('simulation', false);\n   });\n \n-  test('should call onSimulationEnd prop with root element', () => {\n-    graph.instance().onSimulationEnd();\n+  test('should call onSimulationEnd prop with root element', async () => {\n+    await instance.componentDidMount();\n     expect(onSimulationEnd).toHaveBeenCalledWith(root);\n   });\n });\n \n describe('componentWillReceiveProps', () => {\n-  let graph;\n-  let selectedNode;\n-  let selectedEdge;\n-\n-  beforeEach(() => {\n-    selectedNode = 1;\n-    selectedEdge = { source: 1, target: 2 };\n-    graph = shallow(<Graph graph={graphData} />);\n-  });\n+  const selectedNode = 1;\n+  const selectedEdge = { source: 1, target: 2 };\n \n   test('should call refresh if new prop graph are not equal to old one', () => {\n-    graph.instance().refresh = jest.fn();\n-    graph.instance().componentWillReceiveProps({\n+    const graphWrapper = shallow(<Graph graph={graph} />);\n+    const instance = graphWrapper.instance();\n+    instance.refresh = jest.fn();\n+    instance.componentWillReceiveProps({\n       graph: {\n         nodes: [],\n         edges: [],\n       },\n     });\n-    expect(graph.instance().refresh).toHaveBeenCalled();\n+\n+    expect(instance.refresh).toHaveBeenCalled();\n   });\n-  test('should call updateSelection if new props selectedNode and selectedEdge are not equal to old ones', () => {\n-    graph = shallow(<Graph\n-      graph={graphData}\n+\n+  test('should not call refresh if new prop graph are equal to old one', () => {\n+    const graphWrapper = shallow(<Graph graph={graph} />);\n+    const instance = graphWrapper.instance();\n+    instance.refresh = jest.fn();\n+    instance.componentWillReceiveProps({ graph });\n+    expect(instance.refresh).not.toHaveBeenCalled();\n+  });\n+\n+  test('should call updateSelection if new prop selectedNode is not equal to old ones', () => {","path":"src/components/Graph/Graph.spec.js","position":114,"original_position":126,"commit_id":"71c1d80fe696204447ff1b6bd74666325c60e79d","original_commit_id":"71c1d80fe696204447ff1b6bd74666325c60e79d","user":{"login":"Onatolich","id":2663441,"avatar_url":"https://avatars1.githubusercontent.com/u/2663441?v=4","gravatar_id":"","url":"https://api.github.com/users/Onatolich","html_url":"https://github.com/Onatolich","followers_url":"https://api.github.com/users/Onatolich/followers","following_url":"https://api.github.com/users/Onatolich/following{/other_user}","gists_url":"https://api.github.com/users/Onatolich/gists{/gist_id}","starred_url":"https://api.github.com/users/Onatolich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Onatolich/subscriptions","organizations_url":"https://api.github.com/users/Onatolich/orgs","repos_url":"https://api.github.com/users/Onatolich/repos","events_url":"https://api.github.com/users/Onatolich/events{/privacy}","received_events_url":"https://api.github.com/users/Onatolich/received_events","type":"User","site_admin":false},"body":"`should call updateSelection method if selectedNode prop was changed`","created_at":"2017-11-23T13:35:28Z","updated_at":"2017-11-23T13:57:23Z","html_url":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20#discussion_r152802028","pull_request_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/comments/152802028"},"html":{"href":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20#discussion_r152802028"},"pull_request":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20","id":154213180,"html_url":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20","diff_url":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20.diff","patch_url":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20.patch","issue_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/20","number":20,"state":"open","locked":false,"title":"AAV-164/Graph component tets added","user":{"login":"itdev","id":1444570,"avatar_url":"https://avatars0.githubusercontent.com/u/1444570?v=4","gravatar_id":"","url":"https://api.github.com/users/itdev","html_url":"https://github.com/itdev","followers_url":"https://api.github.com/users/itdev/followers","following_url":"https://api.github.com/users/itdev/following{/other_user}","gists_url":"https://api.github.com/users/itdev/gists{/gist_id}","starred_url":"https://api.github.com/users/itdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itdev/subscriptions","organizations_url":"https://api.github.com/users/itdev/orgs","repos_url":"https://api.github.com/users/itdev/repos","events_url":"https://api.github.com/users/itdev/events{/privacy}","received_events_url":"https://api.github.com/users/itdev/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-22T17:20:48Z","updated_at":"2017-11-23T13:57:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09b986f0a8b0da3ef606574d6662376490ad5b4f","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20/commits","review_comments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20/comments","review_comment_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/20/comments","statuses_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/statuses/71c1d80fe696204447ff1b6bd74666325c60e79d","head":{"label":"mulesoft:AAV-154/Cover-canvas-refresh-with-unit-tests","ref":"AAV-154/Cover-canvas-refresh-with-unit-tests","sha":"71c1d80fe696204447ff1b6bd74666325c60e79d","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars1.githubusercontent.com/u/185740?v=4","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":106574381,"name":"analytics-appviz-canvas","full_name":"mulesoft/analytics-appviz-canvas","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars1.githubusercontent.com/u/185740?v=4","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/analytics-appviz-canvas","description":null,"fork":false,"url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas","forks_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/forks","keys_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/teams","hooks_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/events","assignees_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/tags","blobs_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/languages","stargazers_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/subscription","commits_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/merges","archive_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/downloads","issues_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/releases{/id}","deployments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/deployments","created_at":"2017-10-11T15:42:51Z","updated_at":"2017-10-12T17:01:17Z","pushed_at":"2017-11-23T12:48:01Z","git_url":"git://github.com/mulesoft/analytics-appviz-canvas.git","ssh_url":"git@github.com:mulesoft/analytics-appviz-canvas.git","clone_url":"https://github.com/mulesoft/analytics-appviz-canvas.git","svn_url":"https://github.com/mulesoft/analytics-appviz-canvas","homepage":null,"size":889,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"AAV-17/Canvas"}},"base":{"label":"mulesoft:master","ref":"master","sha":"e20ad65d53fa16d7c7bd5132efc517f7042ec233","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars1.githubusercontent.com/u/185740?v=4","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":106574381,"name":"analytics-appviz-canvas","full_name":"mulesoft/analytics-appviz-canvas","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars1.githubusercontent.com/u/185740?v=4","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/analytics-appviz-canvas","description":null,"fork":false,"url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas","forks_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/forks","keys_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/teams","hooks_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/events","assignees_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/tags","blobs_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/languages","stargazers_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/subscription","commits_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/merges","archive_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/downloads","issues_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/releases{/id}","deployments_url":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/deployments","created_at":"2017-10-11T15:42:51Z","updated_at":"2017-10-12T17:01:17Z","pushed_at":"2017-11-23T12:48:01Z","git_url":"git://github.com/mulesoft/analytics-appviz-canvas.git","ssh_url":"git@github.com:mulesoft/analytics-appviz-canvas.git","clone_url":"https://github.com/mulesoft/analytics-appviz-canvas.git","svn_url":"https://github.com/mulesoft/analytics-appviz-canvas","homepage":null,"size":889,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"AAV-17/Canvas"}},"_links":{"self":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20"},"html":{"href":"https://github.com/mulesoft/analytics-appviz-canvas/pull/20"},"issue":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/20"},"comments":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/mulesoft/analytics-appviz-canvas/statuses/71c1d80fe696204447ff1b6bd74666325c60e79d"}},"author_association":"NONE"}}
{"actor":{"display_login":"Onatolich"}}