You've already forked agentic-coding-workflow
feat(notify): dummy notifier writing structured log lines
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDummy_Send_LogsAndReturnsNil(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
log := slog.New(slog.NewJSONHandler(&buf, nil))
|
||||
d := NewDummyNotifier(log)
|
||||
|
||||
require.Equal(t, ChannelDummy, d.Name())
|
||||
err := d.Send(context.Background(), Message{
|
||||
ID: uuid.New(), UserID: uuid.New(),
|
||||
Topic: "x", Severity: SeverityInfo, Title: "hi", Body: "world",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Contains(t, buf.String(), "notify[dummy]")
|
||||
require.Contains(t, buf.String(), `"topic":"x"`)
|
||||
}
|
||||
Reference in New Issue
Block a user