Wrote session dial tests. Use new helpers.

This commit is contained in:
Jay
2026-04-19 09:58:41 -04:00
parent 6998ccf701
commit 45b1a31cbb
9 changed files with 175 additions and 91 deletions
+4 -6
View File
@@ -31,14 +31,14 @@ func _TestPoolConnect(t *testing.T) {
err = pool.Connect("wss://test")
assert.NoError(t, err)
assert.Eventually(t, func() bool {
honeybeetest.Eventually(t, func() bool {
select {
case event := <-pool.events:
return event.ID == "wss://test" && event.Kind == EventConnected
default:
return false
}
}, honeybeetest.TestTimeout, honeybeetest.TestTick)
}, "expected event")
_, exists := pool.peers["wss://test"]
assert.True(t, exists)
@@ -214,14 +214,12 @@ func expectEvent(
expectedKind PoolEventKind,
) {
t.Helper()
assert.Eventually(t, func() bool {
honeybeetest.Eventually(t, func() bool {
select {
case e := <-events:
return e.ID == expectedURL && e.Kind == expectedKind
default:
return false
}
}, honeybeetest.TestTimeout, honeybeetest.TestTick,
fmt.Sprintf("expected event: URL=%q, Kind=%q",
expectedURL, expectedKind))
}, fmt.Sprintf("expected event: URL=%q, Kind=%q", expectedURL, expectedKind))
}