{"action":"created","comment":{"url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/comments/81577177","pull_request_review_id":2547066,"id":81577177,"diff_hunk":"@@ -6,47 +6,63 @@ const PeerId = require('peer-id')\n const Multiaddr = require('multiaddr')\n const PeerInfo = require('../src')\n \n-describe('peer-info', function () {\n-  this.timeout(20000)\n+describe('peer-info', () => {\n+  let pi\n+  beforeEach((done) => {\n+    PeerInfo.create((err, _pi) => {\n+      if (err) {\n+        return done(err)\n+      }\n+      pi = _pi\n+      done()\n+    })\n+  })\n \n-  it('create with Id', () => {\n-    const id = PeerId.create()\n-    const pi = new PeerInfo(id)\n-    expect(pi).to.exist\n-    expect(pi.id).to.exist\n-    expect(pi.id).to.deep.equal(id)\n+  it('create with Id', (done) => {\n+    PeerId.create((err, id) => {\n+      expect(err).to.not.exist\n+      const pi = new PeerInfo(id)\n+      const pi2 = PeerInfo(id)\n+      expect(pi).to.exist\n+      expect(pi.id).to.exist\n+      expect(pi.id).to.deep.equal(id)\n+      expect(pi2).to.exist\n+      expect(pi2.id).to.exist\n+      expect(pi2.id).to.deep.equal(id)\n+      done()\n+    })\n   })\n \n-  it('create without passing an Id', () => {\n-    const pi = new PeerInfo()\n-    expect(pi).to.exist\n-    expect(pi.id).to.exist\n+  it('throws when not passing an Id', () => {\n+    expect(\n+      () => new PeerInfo()\n+    ).to.throw()\n   })\n \n-  it('create without \"new\"', () => {\n-    const pi = PeerInfo()\n-    expect(pi).to.exist\n-    expect(pi.id).to.exist\n+  it('PeerInfo.create', (done) => {\n+    PeerInfo.create((err, pi) => {\n+      expect(err).to.not.exist\n+      expect(pi).to.exist\n+      expect(pi.id).to.exist\n+      done()\n+    })\n   })\n \n   it('add multiaddr', () => {\n-    const pi = new PeerInfo()\n     expect(pi).to.exist\n     const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')\n     pi.multiaddr.add(mh)\n     expect(pi.multiaddrs.length).to.equal(1)\n   })\n \n   it('add multiaddr that are buffers', () => {\n-    const pi = new PeerInfo()\n     expect(pi).to.exist\n     const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')\n     pi.multiaddr.add(mh.buffer)\n     expect(pi.multiaddrs[0] instanceof Multiaddr).to.equal(true)\n   })\n \n   it('add repeated multiaddr', () => {\n-    const pi = new PeerInfo()\n     expect(pi).to.exist","path":"test/peer-info.spec.js","position":80,"original_position":80,"commit_id":"0e2023cbe2e6c03518526b4678a90ae0c75d3411","original_commit_id":"0e2023cbe2e6c03518526b4678a90ae0c75d3411","user":{"login":"diasdavid","id":1211152,"avatar_url":"https://avatars.githubusercontent.com/u/1211152?v=3","gravatar_id":"","url":"https://api.github.com/users/diasdavid","html_url":"https://github.com/diasdavid","followers_url":"https://api.github.com/users/diasdavid/followers","following_url":"https://api.github.com/users/diasdavid/following{/other_user}","gists_url":"https://api.github.com/users/diasdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/diasdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diasdavid/subscriptions","organizations_url":"https://api.github.com/users/diasdavid/orgs","repos_url":"https://api.github.com/users/diasdavid/repos","events_url":"https://api.github.com/users/diasdavid/events{/privacy}","received_events_url":"https://api.github.com/users/diasdavid/received_events","type":"User","site_admin":false},"body":"same","created_at":"2016-10-03T15:41:29Z","updated_at":"2016-10-03T15:41:58Z","html_url":"https://github.com/libp2p/js-peer-info/pull/22#discussion_r81577177","pull_request_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/comments/81577177"},"html":{"href":"https://github.com/libp2p/js-peer-info/pull/22#discussion_r81577177"},"pull_request":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22","id":85059823,"html_url":"https://github.com/libp2p/js-peer-info/pull/22","diff_url":"https://github.com/libp2p/js-peer-info/pull/22.diff","patch_url":"https://github.com/libp2p/js-peer-info/pull/22.patch","issue_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/22","number":22,"state":"open","locked":false,"title":"refactor: PeerId.create is now async","user":{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false},"body":"Ref https://github.com/libp2p/js-libp2p-crypto/pull/10\r\n\r\nBREAKING CHANGE\r\n\r\nNew method PeerInfo.create(cb) replaces the previous new PeerInfo() to create a fresh id\r\n","created_at":"2016-09-13T14:32:21Z","updated_at":"2016-10-03T15:41:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4fc18b7dc498b12640ecca4165be924372a4b6a","assignee":{"login":"diasdavid","id":1211152,"avatar_url":"https://avatars.githubusercontent.com/u/1211152?v=3","gravatar_id":"","url":"https://api.github.com/users/diasdavid","html_url":"https://github.com/diasdavid","followers_url":"https://api.github.com/users/diasdavid/followers","following_url":"https://api.github.com/users/diasdavid/following{/other_user}","gists_url":"https://api.github.com/users/diasdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/diasdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diasdavid/subscriptions","organizations_url":"https://api.github.com/users/diasdavid/orgs","repos_url":"https://api.github.com/users/diasdavid/repos","events_url":"https://api.github.com/users/diasdavid/events{/privacy}","received_events_url":"https://api.github.com/users/diasdavid/received_events","type":"User","site_admin":false},"assignees":[{"login":"diasdavid","id":1211152,"avatar_url":"https://avatars.githubusercontent.com/u/1211152?v=3","gravatar_id":"","url":"https://api.github.com/users/diasdavid","html_url":"https://github.com/diasdavid","followers_url":"https://api.github.com/users/diasdavid/followers","following_url":"https://api.github.com/users/diasdavid/following{/other_user}","gists_url":"https://api.github.com/users/diasdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/diasdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diasdavid/subscriptions","organizations_url":"https://api.github.com/users/diasdavid/orgs","repos_url":"https://api.github.com/users/diasdavid/repos","events_url":"https://api.github.com/users/diasdavid/events{/privacy}","received_events_url":"https://api.github.com/users/diasdavid/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22/commits","review_comments_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22/comments","review_comment_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/22/comments","statuses_url":"https://api.github.com/repos/libp2p/js-peer-info/statuses/0e2023cbe2e6c03518526b4678a90ae0c75d3411","head":{"label":"libp2p:fast-keys","ref":"fast-keys","sha":"0e2023cbe2e6c03518526b4678a90ae0c75d3411","user":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":38784179,"name":"js-peer-info","full_name":"libp2p/js-peer-info","owner":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libp2p/js-peer-info","description":"IPFS Peer abstraction Node.js implementation","fork":false,"url":"https://api.github.com/repos/libp2p/js-peer-info","forks_url":"https://api.github.com/repos/libp2p/js-peer-info/forks","keys_url":"https://api.github.com/repos/libp2p/js-peer-info/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/js-peer-info/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/js-peer-info/teams","hooks_url":"https://api.github.com/repos/libp2p/js-peer-info/hooks","issue_events_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/js-peer-info/events","assignees_url":"https://api.github.com/repos/libp2p/js-peer-info/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/js-peer-info/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/js-peer-info/tags","blobs_url":"https://api.github.com/repos/libp2p/js-peer-info/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/js-peer-info/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/js-peer-info/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/js-peer-info/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/js-peer-info/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/js-peer-info/languages","stargazers_url":"https://api.github.com/repos/libp2p/js-peer-info/stargazers","contributors_url":"https://api.github.com/repos/libp2p/js-peer-info/contributors","subscribers_url":"https://api.github.com/repos/libp2p/js-peer-info/subscribers","subscription_url":"https://api.github.com/repos/libp2p/js-peer-info/subscription","commits_url":"https://api.github.com/repos/libp2p/js-peer-info/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/js-peer-info/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/js-peer-info/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/js-peer-info/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/js-peer-info/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/js-peer-info/merges","archive_url":"https://api.github.com/repos/libp2p/js-peer-info/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/js-peer-info/downloads","issues_url":"https://api.github.com/repos/libp2p/js-peer-info/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/js-peer-info/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/js-peer-info/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/js-peer-info/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/js-peer-info/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/js-peer-info/deployments","created_at":"2015-07-08T22:49:06Z","updated_at":"2016-09-03T16:35:45Z","pushed_at":"2016-10-02T14:51:26Z","git_url":"git://github.com/libp2p/js-peer-info.git","ssh_url":"git@github.com:libp2p/js-peer-info.git","clone_url":"https://github.com/libp2p/js-peer-info.git","svn_url":"https://github.com/libp2p/js-peer-info","homepage":null,"size":236,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":7,"default_branch":"master"}},"base":{"label":"libp2p:master","ref":"master","sha":"3639f8e943984f029bf1089f31d58f8b3d335d88","user":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":38784179,"name":"js-peer-info","full_name":"libp2p/js-peer-info","owner":{"login":"libp2p","id":14838238,"avatar_url":"https://avatars.githubusercontent.com/u/14838238?v=3","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libp2p/js-peer-info","description":"IPFS Peer abstraction Node.js implementation","fork":false,"url":"https://api.github.com/repos/libp2p/js-peer-info","forks_url":"https://api.github.com/repos/libp2p/js-peer-info/forks","keys_url":"https://api.github.com/repos/libp2p/js-peer-info/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/js-peer-info/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/js-peer-info/teams","hooks_url":"https://api.github.com/repos/libp2p/js-peer-info/hooks","issue_events_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/js-peer-info/events","assignees_url":"https://api.github.com/repos/libp2p/js-peer-info/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/js-peer-info/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/js-peer-info/tags","blobs_url":"https://api.github.com/repos/libp2p/js-peer-info/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/js-peer-info/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/js-peer-info/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/js-peer-info/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/js-peer-info/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/js-peer-info/languages","stargazers_url":"https://api.github.com/repos/libp2p/js-peer-info/stargazers","contributors_url":"https://api.github.com/repos/libp2p/js-peer-info/contributors","subscribers_url":"https://api.github.com/repos/libp2p/js-peer-info/subscribers","subscription_url":"https://api.github.com/repos/libp2p/js-peer-info/subscription","commits_url":"https://api.github.com/repos/libp2p/js-peer-info/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/js-peer-info/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/js-peer-info/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/js-peer-info/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/js-peer-info/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/js-peer-info/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/js-peer-info/merges","archive_url":"https://api.github.com/repos/libp2p/js-peer-info/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/js-peer-info/downloads","issues_url":"https://api.github.com/repos/libp2p/js-peer-info/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/js-peer-info/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/js-peer-info/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/js-peer-info/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/js-peer-info/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/js-peer-info/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/js-peer-info/deployments","created_at":"2015-07-08T22:49:06Z","updated_at":"2016-09-03T16:35:45Z","pushed_at":"2016-10-02T14:51:26Z","git_url":"git://github.com/libp2p/js-peer-info.git","ssh_url":"git@github.com:libp2p/js-peer-info.git","clone_url":"https://github.com/libp2p/js-peer-info.git","svn_url":"https://github.com/libp2p/js-peer-info","homepage":null,"size":236,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22"},"html":{"href":"https://github.com/libp2p/js-peer-info/pull/22"},"issue":{"href":"https://api.github.com/repos/libp2p/js-peer-info/issues/22"},"comments":{"href":"https://api.github.com/repos/libp2p/js-peer-info/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libp2p/js-peer-info/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/libp2p/js-peer-info/statuses/0e2023cbe2e6c03518526b4678a90ae0c75d3411"}}}}
{"actor":{"display_login":"diasdavid"}}