Skip to content

Commit

Permalink
test(fix): fix listening test for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed Jan 24, 2020
1 parent 8b94cd1 commit 29a9669
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions test/core/listening.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ describe('Listening', () => {
// Should get something like:
// /ip4/127.0.0.1/tcp/50866
// /ip4/192.168.1.2/tcp/50866
expect(addrs.length).to.equal(2)

const opts = [addrs[0].toOptions(), addrs[1].toOptions()]
expect(opts[0].family).to.equal('ipv4')
expect(opts[1].family).to.equal('ipv4')
expect(opts[0].transport).to.equal('tcp')
expect(opts[1].transport).to.equal('tcp')
expect(opts[0].host).to.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)
expect(opts[1].host).to.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)
expect(opts[0].port).to.be.gt(0)
expect(opts[1].port).to.be.gt(0)
expect(addrs.length).to.be.at.least(2)
for (const addr of addrs) {
const opts = addr.toOptions()
expect(opts.family).to.equal('ipv4')
expect(opts.transport).to.equal('tcp')
expect(opts.host).to.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)
expect(opts.port).to.be.gt(0)
}
})
})

0 comments on commit 29a9669

Please sign in to comment.