refactor(go): default to go vehicle topics

This commit is contained in:
lingniu
2026-07-02 20:22:47 +08:00
parent 3248336bea
commit 2ae9794dda
15 changed files with 130 additions and 27 deletions

View File

@@ -40,6 +40,23 @@ func TestNATSSinkRoutesRawAndUnifiedSubjects(t *testing.T) {
}
}
func TestNATSSinkDefaultsToGoRawSubjects(t *testing.T) {
publisher := &recordingNATSPublisher{}
sink := newNATSSinkWithPublisher(publisher, NATSConfig{})
err := sink.PublishRaw(context.Background(), envelope.FrameEnvelope{
Protocol: envelope.ProtocolJT808,
Phone: "13307795425",
ReceivedAtMS: 1782918600000,
})
if err != nil {
t.Fatalf("PublishRaw() error = %v", err)
}
if got, want := publisher.messages[0].subject, "vehicle.raw.go.jt808.v1"; got != want {
t.Fatalf("subject = %q, want %q", got, want)
}
}
type recordingNATSPublisher struct {
messages []recordedNATSMessage
}