fix(go): skip empty frames in realtime snapshot
This commit is contained in:
@@ -75,6 +75,29 @@ func TestSnapshotWriterSkipsUnknownVehicleKey(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSnapshotWriterSkipsGB32960HeartbeatWithoutRealtimePayload(t *testing.T) {
|
||||
exec := &recordingSnapshotExec{}
|
||||
writer := NewSnapshotWriter(exec)
|
||||
|
||||
if err := writer.Update(context.Background(), envelope.FrameEnvelope{
|
||||
Protocol: envelope.ProtocolGB32960,
|
||||
MessageID: "0x07",
|
||||
VIN: "ABCDE600000000009",
|
||||
Parsed: map[string]any{
|
||||
"header": map[string]any{
|
||||
"vin": "ABCDE600000000009",
|
||||
"command": "0x07",
|
||||
"actual_body_length": 0,
|
||||
},
|
||||
},
|
||||
}); err != nil {
|
||||
t.Fatalf("Update() error = %v", err)
|
||||
}
|
||||
if len(exec.calls) != 0 {
|
||||
t.Fatalf("exec calls = %d, want 0", len(exec.calls))
|
||||
}
|
||||
}
|
||||
|
||||
type recordingSnapshotExec struct {
|
||||
calls []snapshotExecCall
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user