Closed chrisekelley closed 6 years ago
Awesome! Last little nit pick and I think it'll be good to go. :D
Wait, crap I was wrong! The socket needs to be wrapped in a promise. :( Sorry!
Something like
socket = etc..
return new Promise((resolve, reject) => {
socket.once('data' (etc) => {
try {
assert(whatever)
} catch(e) {
reject(e)
}
resolve()
})
})
I added delay after all as well as the promise. These tests are so inconsistent - sometimes they work, sometimes not. Feels like the moon is in full effect... But anyway, this time they did work:
dat-gateway
✓ should exist
✓ should handle requests (3187ms)
✓ should handle requests for dead addresses (3036ms)
✓ should proactively deleted expired archives (12007ms)
✓ should handle websockets for replication (3011ms)
✓ should open a websocket to /peers (5303ms)
6 passing (40s)
Would you be up for becoming a collaborator on this repo so you could merge stuff yourself?
Sure, yeah, that would be great!
Cool! I sent you an invite. It should be sent to your github email.
I added axios to the devDependencies to make it a tad easier to test w/ promises. The new code now waits for the request for the download to complete before opening the socket.