RangerMauve / hyperswarm-web

Implementation of the hyperswarm API for use in web browsers
MIT License
102 stars 15 forks source link

beefed up test #16

Closed DougAnderson444 closed 2 years ago

DougAnderson444 commented 3 years ago

Hi Mauve,

I had some trouble getting Hyperswarm-web client working locally with a local server, the result of that trouble is this verbose test.

Thought I'd toss this up into a PR since there may be someone else struggling to make it work, the code example in the test might help them too?

Backstory: Turns out { announceLocalAddress: true } seems to be critical for a local client to connect to a local hyperswarm-web server? As soon as that was added, all my troubles seemed to melt away. Only saw it deep in the hyperswarm example code, wasn't really documented anywhere.

    const hostname = `ws://localhost:${port}`

    const client = hyperswarmweb({
      announceLocalAddress: true,
      wsProxy: [hostname]
    })
DougAnderson444 commented 3 years ago

Hmm, maybe I spoke too soon about the announceLocalAddress, but the test is still valid 🤔

RangerMauve commented 3 years ago

Interesting, what does this test cover that wasn't before?

I'd be down to merge if you could remove the commented out code and added t.pass or t.fail assertions instead of console logs. 😁