Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
fix: Cleanup some todos - fix: #28
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Oct 28, 2017
1 parent f29ef52 commit aebb3c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const setImmediate = require('async/setImmediate')
const utils = require('./utils')
const Listener = require('./listener')
const cleanUrlSIO = utils.cleanUrlSIO
const mafmt = require('mafmt')

class WebsocketStar {
/**
Expand Down Expand Up @@ -101,10 +102,7 @@ class WebsocketStar {
multiaddrs = [multiaddrs]
}

return multiaddrs.filter((ma) => {
// TODO this should be using mafmt
return ma.toString().indexOf('p2p-websocket-star') > 0
})
return multiaddrs.filter((ma) => mafmt.WebSocketStar.matches(ma))
}

/**
Expand Down
1 change: 0 additions & 1 deletion test/discovery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const each = require('async/each')

const WebSocketStar = require('../src')

// TODO Peer Discovery is broken
describe('peer discovery', () => {
let listeners = []
let ws1
Expand Down
4 changes: 2 additions & 2 deletions test/filter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const multiaddr = require('multiaddr')
const WebSocketStar = require('../src')

describe('filter', () => {
it('filters non valid webrtc-star multiaddrs', () => {
it('filters non valid websocket-star multiaddrs', () => {
const ws = new WebSocketStar()

const maArr = [
Expand All @@ -30,7 +30,7 @@ describe('filter', () => {

const filtered = ws.filter(maArr)
expect(filtered.length).to.not.equal(maArr.length)
expect(filtered.length).to.equal(10)
expect(filtered.length).to.equal(8)
})

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

0 comments on commit aebb3c5

Please sign in to comment.