32 lines
776 B
Go

package integration
import (
"encoding/json"
"testing"
)
func TestUserTotalRechargeAcceptsNumericTimestamps(t *testing.T) {
var item UserTotalRecharge
raw := []byte(`{
"id":"2049097310624870401",
"userId":"2042274349343506434",
"type":"SHIPPING_AGENT",
"amount":1.60,
"createTime":1777377844000,
"updateTime":1777556451000
}`)
if err := json.Unmarshal(raw, &item); err != nil {
t.Fatalf("json.Unmarshal() error = %v", err)
}
if item.CreateTime != "1777377844000" {
t.Fatalf("CreateTime = %q, want numeric timestamp string", item.CreateTime)
}
if item.UpdateTime != "1777556451000" {
t.Fatalf("UpdateTime = %q, want numeric timestamp string", item.UpdateTime)
}
if item.Amount != "1.60" {
t.Fatalf("Amount = %q, want 1.60", item.Amount)
}
}