Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix: add tests for ipv6 wildcard support (#203)
Browse files Browse the repository at this point in the history
Adds tests from #100 as the feature has been implemented already.
  • Loading branch information
achingbrain committed Aug 30, 2022
1 parent a819c0d commit 71c974d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/compliance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe('interface-transport compliance', () => {
const addrs = [
new Multiaddr('/ip4/127.0.0.1/tcp/9091'),
new Multiaddr('/ip4/127.0.0.1/tcp/9092'),
new Multiaddr('/ip4/127.0.0.1/tcp/9093')
new Multiaddr('/ip4/127.0.0.1/tcp/9093'),
new Multiaddr('/ip6/::/tcp/9094')
]

// Used by the dial tests to simulate a delayed connect
Expand Down
12 changes: 12 additions & 0 deletions test/listen-dial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ describe('listen', () => {
expect(multiaddrs[0].toString().indexOf('0.0.0.0')).to.equal(-1)
})

it('getAddrs from listening on ip6 \'::\'', async () => {
const mh = new Multiaddr('/ip6/::/tcp/9090')
listener = tcp.createListener({
upgrader
})
await listener.listen(mh)

const multiaddrs = listener.getAddrs()
expect(multiaddrs.length > 0).to.equal(true)
expect(multiaddrs[0].toOptions().host).to.not.equal('::')
})

it('getAddrs preserves IPFS Id', async () => {
const mh = new Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener({
Expand Down

0 comments on commit 71c974d

Please sign in to comment.