prepare code skeleton to develop remaining managers

This commit is contained in:
Jay
2026-06-03 15:04:08 -04:00
parent 29f6966ae0
commit e360f35ee5
7 changed files with 506 additions and 27 deletions
+33
View File
@@ -0,0 +1,33 @@
package prism
import (
"testing"
)
func TestNoticeHandler(t *testing.T) {
t.Run("notice delivered", func(t *testing.T) {
// p, envoy := newMockEnvoy(t)
// h := NewNoticeHandler(envoy)
// t.Cleanup(h.Close)
// p.receive(envelope.EncloseNotice("hello"))
// Eventually: receive from h.Notices()
// assert Message == "hello", PeerID == p.url, Timestamp non-zero
})
t.Run("malformed ignored", func(t *testing.T) {
// p.receive([]byte("not json"))
// Never: nothing readable from h.Notices() within NegativeTestTimeout
// assert no panic
})
t.Run("observer notified", func(t *testing.T) {
// wire mockObserver via envoy (requires constructor option or mock envoy)
// p.receive(envelope.EncloseNotice("hello"))
// Eventually: mockObserver recorded NoticeReceived{Message: "hello"}
})
t.Run("close cleans up", func(t *testing.T) {
// h.Close()
// assert <-h.Notices() returns zero Notice, ok == false
})
}