Open RangerMauve opened 6 years ago
Looks good, would you mind adding some automated tests for it? Beaker has some you can use as a reference.
Awesome! I'll try to get on that this week. :D
I see the archives.test.js
file is empty. Should I use ava for the tests since that's what beaker is using?
😅 oh right, I forgot that I haven't gotten any tests into this thing either. What a hypocrite!
Yeah would you mind? ava is what I'd want to use.
Yeah, no prob! I'll just copy the tests from beaker verbatim and convert it to use the dat-node APIs instead of electron/beaker.
I've copied over the tests, but something weird is happening. Would you mind looking to see if I have some glaring mistake I'm missing?
When it uses getSessionData()
on the first datPeers
instance, it reports "right"
even though I invoke setSessionData("left")
earlier.
It's like the session data is being transferred between the peers, I'm not sure how that can be happening though.
Sure I'll check into it. Thanks for putting the tests together!
No rush! I'll take another shot at it later this week. :D
I did some debugging and found at least one case of arguments being in the wrong order, https://github.com/beakerbrowser/dat-node/pull/6/files#diff-e658a4aa904bdaccea0046252d2e13d3R83
That didn't solve the issues but I'd look for things like that
K, looking into it a bit today. So far it seems that broadcast just isn't working. Not sure if it's a sending issue, a receiving issue, or me not relaying events properly.
So, this is weird. I think it's a timing issue in the tests. When I use dat-node
in a REPL, it seems to work fine. But when it runs in the tests, the sessionData isn't being set. :S
K, so the first problem was that I was creating a single instance of datEphemeralExtMsg
/ datSessionDataExtMsg
that was shared between both dat-node
instances. 🤦♂️
Now I can get/set session data properly, but the broadcasting still isn't working. That part might be a timing issue. Gonna look into it more another day.
I'm at a bit of a loss here.
When I test it out with the browser it seems to be working OK, but I'm not able to get two instances of dat node in the tests to work.
Any help would be very much appreciated.
@RangerMauve sure thing. Just push up your latest code and I'll dig around a bit.
It's pushed. 😁
Closes #3
It's kinda rough, but I based it on the implementation in beaker-core and added an easy interface for it.
I've tested it out with this page and it all seems to be working.