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

Commit

Permalink
chore: add test for filtering unix socket address (#229)
Browse files Browse the repository at this point in the history
Fixes #132
  • Loading branch information
achingbrain authored Nov 17, 2022
1 parent 24c5b37 commit efcfbb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Transport } from '@libp2p/interface-transport'
describe('filter addrs', () => {
const base = '/ip4/127.0.0.1'
const ipfs = '/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw'
const unix = '/tmp/some/file.sock'

let transport: Transport

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

const valid = transport.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8])
expect(valid.length).to.equal(4)
const valid = transport.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8, ma9])
expect(valid.length).to.equal(5)
expect(valid[0]).to.deep.equal(ma1)
expect(valid[1]).to.deep.equal(ma4)
expect(valid[4]).to.deep.equal(ma9)
})

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

0 comments on commit efcfbb2

Please sign in to comment.