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

Commit efcfbb2

Browse files
authored
chore: add test for filtering unix socket address (#229)
Fixes #132
1 parent 24c5b37 commit efcfbb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/filter.spec.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { Transport } from '@libp2p/interface-transport'
66
describe('filter addrs', () => {
77
const base = '/ip4/127.0.0.1'
88
const ipfs = '/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw'
9+
const unix = '/tmp/some/file.sock'
910

1011
let transport: Transport
1112

@@ -22,11 +23,13 @@ describe('filter addrs', () => {
2223
const ma6 = multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
2324
const ma7 = multiaddr('/dns4/libp2p.io/tcp/9090')
2425
const ma8 = multiaddr('/dnsaddr/libp2p.io/tcp/9090')
26+
const ma9 = multiaddr('/unix' + unix)
2527

26-
const valid = transport.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8])
27-
expect(valid.length).to.equal(4)
28+
const valid = transport.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9])
29+
expect(valid.length).to.equal(5)
2830
expect(valid[0]).to.deep.equal(ma1)
2931
expect(valid[1]).to.deep.equal(ma4)
32+
expect(valid[4]).to.deep.equal(ma9)
3033
})
3134

3235
it('filter a single addr for this transport', () => {

0 commit comments

Comments
 (0)