mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Replace github.com/pocketbase/pocketbase with github.com/hanzoai/base in 106 Go source files. Keep pocketbase/dbx and pocketbase/tygoja as-is (upstream dependencies). Add compiled binary to .gitignore. Include realtime DX design document inspired by Convex patterns.
26 lines
456 B
Go
26 lines
456 B
Go
package subscriptions_test
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/hanzoai/base/tools/subscriptions"
|
|
)
|
|
|
|
func TestMessageWrite(t *testing.T) {
|
|
m := subscriptions.Message{
|
|
Name: "test_name",
|
|
Data: []byte("test_data"),
|
|
}
|
|
|
|
var sb strings.Builder
|
|
|
|
m.WriteSSE(&sb, "test_id")
|
|
|
|
expected := "id:test_id\nevent:test_name\ndata:test_data\n\n"
|
|
|
|
if v := sb.String(); v != expected {
|
|
t.Fatalf("Expected writer content\n%q\ngot\n%q", expected, v)
|
|
}
|
|
}
|