From ffbe0fb56fa01118135c44868f712da4303f7147 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Sat, 6 May 2017 19:02:35 +1000 Subject: [PATCH] checkgin empty field for events --- inMsg_test.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/inMsg_test.go b/inMsg_test.go index 470b43c..4d78697 100644 --- a/inMsg_test.go +++ b/inMsg_test.go @@ -188,6 +188,10 @@ func TestReadEventClick(t *testing.T) { m := ReadEventMsg(msg) AssertEqual(t, m.Event, "CLICK", "Expect Click event") AssertEqual(t, m.EventKey, "MEMBER_SEARCH", "Expect MEMBER_SEARCH") + AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") + AssertEqual(t, m.Latitude, 0.0, "Expect 0") + AssertEqual(t, m.Longitude, 0.0, "Expect 0") + AssertEqual(t, m.Precision, 0.0, "Expect 0") } func TestAcceptLocationInfo(t *testing.T) { @@ -226,6 +230,9 @@ func TestAcceptLocationInfo(t *testing.T) { AssertEqual(t, m.Longitude, 150.960327, "Expect 150.960327") AssertEqual(t, m.Latitude, -33.764935, "Expect -33.764935") AssertEqual(t, m.Precision, 110.000000, "Expect 110.000000") + AssertEqual(t, m.EventKey, "", "Expect Empty EventKey") + AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") + } func TestReadEventFollow(t *testing.T) { @@ -238,6 +245,11 @@ func TestReadEventFollow(t *testing.T) { ` m := ReadEventMsg(msg) AssertEqual(t, m.Event, "subscribe", "Expect subscribe") + AssertEqual(t, m.EventKey, "", "Expect Empty EventKey") + AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") + AssertEqual(t, m.Latitude, 0.0, "Expect 0") + AssertEqual(t, m.Longitude, 0.0, "Expect 0") + AssertEqual(t, m.Precision, 0.0, "Expect 0") } @@ -254,6 +266,9 @@ func TestReadEventScanNoFollow(t *testing.T) { AssertEqual(t, m.Event, "subscribe", "Expect subscribe") AssertEqual(t, m.EventKey, "qrscene_123123", "Expect qrscene_123123") AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") + AssertEqual(t, m.Latitude, 0.0, "Expect 0") + AssertEqual(t, m.Longitude, 0.0, "Expect 0") + AssertEqual(t, m.Precision, 0.0, "Expect 0") } @@ -271,6 +286,9 @@ func TestReadEventScanWithFollow(t *testing.T) { AssertEqual(t, m.Event, "SCAN", "Expect SCAN") AssertEqual(t, m.EventKey, "SCENE_VALUE", "Expect SCENE_VALUE") AssertEqual(t, m.Ticket, "TICKET", "Expect TICKET") + AssertEqual(t, m.Latitude, 0.0, "Expect 0") + AssertEqual(t, m.Longitude, 0.0, "Expect 0") + AssertEqual(t, m.Precision, 0.0, "Expect 0") } @@ -286,6 +304,9 @@ func TestReadEventView(t *testing.T) { m := ReadEventMsg(msg) AssertEqual(t, m.Event, "VIEW", "Expect VIEW") AssertEqual(t, m.EventKey, "www.qq.com", "Expectwww.qq.com") - AssertEqual(t, m.Ticket, "", "Expect empty ") + AssertEqual(t, m.Ticket, "", "Expect Empty Ticket") + AssertEqual(t, m.Latitude, 0.0, "Expect 0") + AssertEqual(t, m.Longitude, 0.0, "Expect 0") + AssertEqual(t, m.Precision, 0.0, "Expect 0") }