Skip to content

Commit

Permalink
fix: p2p-circuit validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy ryajov authored and dmitriy ryajov committed Feb 26, 2017
1 parent c05c1af commit 14db530
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const Circuit = or(

const IPFS = or(
and(_IPFS, Circuit),
and(Circuit, _IPFS),
Circuit,
_IPFS
)

Expand Down
8 changes: 4 additions & 4 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ describe('multiaddr validation', function () {
'/p2p-circuit/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj',
'/p2p-circuit/ip4/127.0.0.1/tcp/20008/ws/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj',
'/p2p-circuit/libp2p-webrtc-star/ip4/1.2.3.4/tcp/3456/ws/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/p2p-circuit/ip4/1.2.3.4/tcp/3456/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4'
'/p2p-circuit/ip4/1.2.3.4/tcp/3456/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/p2p-circuit/ip4/127.0.0.1/tcp/4002/ipfs/QmddWMcQX6orJGHpETYMyPgXrCXCtYANMFVDCvhKoDwLqA',
'/p2p-circuit/ipfs/QmddWMcQX6orJGHpETYMyPgXrCXCtYANMFVDCvhKoDwLqA'
]

const goodIPFS = [
Expand All @@ -106,9 +108,7 @@ describe('multiaddr validation', function () {
'/ip4/1.2.3.4/tcp/3456/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4',
'/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit',
'/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj'
]

goodIPFS.concat(goodCircuit)
].concat(goodCircuit)

function assertMatches (p) {
const tests = Array.from(arguments).slice(1)
Expand Down

0 comments on commit 14db530

Please sign in to comment.