Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

Commit 2061b34

Browse files
test: drop superfluous existence check
1 parent 58bf208 commit 2061b34

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

test/peer-info.spec.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const PeerInfo = require('../src')
88

99
describe('peer-info', () => {
1010
let pi
11+
1112
beforeEach((done) => {
1213
PeerInfo.create((err, _pi) => {
1314
if (err) {
@@ -23,7 +24,6 @@ describe('peer-info', () => {
2324
expect(err).to.not.exist
2425
const pi = new PeerInfo(id)
2526
const pi2 = PeerInfo(id)
26-
expect(pi).to.exist
2727
expect(pi.id).to.exist
2828
expect(pi.id).to.deep.equal(id)
2929
expect(pi2).to.exist
@@ -42,28 +42,24 @@ describe('peer-info', () => {
4242
it('PeerInfo.create', (done) => {
4343
PeerInfo.create((err, pi) => {
4444
expect(err).to.not.exist
45-
expect(pi).to.exist
4645
expect(pi.id).to.exist
4746
done()
4847
})
4948
})
5049

5150
it('add multiaddr', () => {
52-
expect(pi).to.exist
5351
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
5452
pi.multiaddr.add(mh)
5553
expect(pi.multiaddrs.length).to.equal(1)
5654
})
5755

5856
it('add multiaddr that are buffers', () => {
59-
expect(pi).to.exist
6057
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
6158
pi.multiaddr.add(mh.buffer)
6259
expect(pi.multiaddrs[0] instanceof Multiaddr).to.equal(true)
6360
})
6461

6562
it('add repeated multiaddr', () => {
66-
expect(pi).to.exist
6763
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
6864
pi.multiaddr.add(mh)
6965
expect(pi.multiaddrs.length).to.equal(1)
@@ -72,7 +68,6 @@ describe('peer-info', () => {
7268
})
7369

7470
it('rm multiaddr', () => {
75-
expect(pi).to.exist
7671
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
7772
pi.multiaddr.add(mh)
7873
expect(pi.multiaddrs.length).to.equal(1)
@@ -81,7 +76,6 @@ describe('peer-info', () => {
8176
})
8277

8378
it('addSafe - avoid multiaddr explosion', () => {
84-
expect(pi).to.exist
8579
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
8680
const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/9002')
8781
const mh3 = Multiaddr('/ip4/127.0.0.1/tcp/9009')
@@ -95,15 +89,13 @@ describe('peer-info', () => {
9589
})
9690

9791
it('addSafe - multiaddr that are buffers', () => {
98-
expect(pi).to.exist
9992
const mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
10093
pi.multiaddr.addSafe(mh.buffer)
10194
pi.multiaddr.addSafe(mh.buffer)
10295
expect(pi.multiaddrs[0] instanceof Multiaddr).to.equal(true)
10396
})
10497

10598
it('replace multiaddr', () => {
106-
expect(pi).to.exist
10799
const mh1 = Multiaddr('/ip4/127.0.0.1/tcp/5001')
108100
const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/5002')
109101
const mh3 = Multiaddr('/ip4/127.0.0.1/tcp/5003')
@@ -127,7 +119,6 @@ describe('peer-info', () => {
127119
})
128120

129121
it('replace multiaddr (no arrays)', () => {
130-
expect(pi).to.exist
131122
const mh1 = Multiaddr('/ip4/127.0.0.1/tcp/5001')
132123
const mh2 = Multiaddr('/ip4/127.0.0.1/tcp/5002')
133124
const mh3 = Multiaddr('/ip4/127.0.0.1/tcp/5003')

0 commit comments

Comments
 (0)