@@ -0,0 +1,27 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPingResponsesIncludeShortDramaCardID(t *testing.T) {
|
||||
const productID = "6a8f066778316ccfc08c4ce7"
|
||||
responses := []any{
|
||||
SysInfo{ShortDramaCardID: productID},
|
||||
SysInfos{ShortDramaCardID: productID},
|
||||
}
|
||||
for _, response := range responses {
|
||||
data, err := json.Marshal(response)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var decoded map[string]any
|
||||
if err = json.Unmarshal(data, &decoded); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := decoded["shortDramaCardId"]; got != productID {
|
||||
t.Fatalf("shortDramaCardId = %v, want %s", got, productID)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user