refactor(go): avoid duplicate realtime protocol payloads
This commit is contained in:
@@ -2,6 +2,7 @@ package realtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
@@ -120,12 +121,12 @@ func TestRepositoryStoresFullParsedProtocolSnapshotAndMergesGB32960Units(t *test
|
||||
if err != nil {
|
||||
t.Fatalf("GetMerged() error = %v", err)
|
||||
}
|
||||
gb, ok := merged.ProtocolData[envelope.ProtocolGB32960]
|
||||
if !ok {
|
||||
t.Fatalf("merged protocol data missing: %#v", merged.ProtocolData)
|
||||
mergedJSON, err := json.Marshal(merged)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(gb["data_units"].([]any)) != 2 {
|
||||
t.Fatalf("merged protocol data did not keep full parsed fields: %#v", gb)
|
||||
if strings.Contains(string(mergedJSON), "protocol_data") {
|
||||
t.Fatalf("merged snapshot should not duplicate full protocol parsed data: %s", string(mergedJSON))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user