cleanup and refactors

This commit is contained in:
Jay
2026-05-20 22:49:25 -04:00
parent cda6d286ab
commit f1afca7921
10 changed files with 628 additions and 496 deletions
+10
View File
@@ -10,7 +10,9 @@ import (
"time"
)
// ----------------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------------
const (
TestTimeout = 2 * time.Second
@@ -18,7 +20,9 @@ const (
NegativeTestTimeout = 100 * time.Millisecond
)
// ----------------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------------
type MockIncomingData struct {
MsgType int
@@ -37,7 +41,9 @@ type ExpectedLog struct {
Attrs map[string]any
}
// ----------------------------------------------------------------------------
// Setup
// ----------------------------------------------------------------------------
func SetupTestSocket(t *testing.T) (
socket *MockSocket,
@@ -81,7 +87,9 @@ func SetupTestSocket(t *testing.T) (
return
}
// ----------------------------------------------------------------------------
// Helpers
// ----------------------------------------------------------------------------
func ExpectIncoming(t *testing.T, incoming <-chan []byte, expected []byte) {
t.Helper()
@@ -126,7 +134,9 @@ func Never(t *testing.T, condition func() bool, msg string) {
assert.Never(t, condition, NegativeTestTimeout, TestTick, msg)
}
// ----------------------------------------------------------------------------
// Logging Helpers
// ----------------------------------------------------------------------------
func AssertLogSequence(t *testing.T, records []slog.Record, expected []ExpectedLog) {
t.Helper()