Bladeren bron

checkgin empty field for events

master
Patrick Peng Sun 8 jaren geleden
bovenliggende
commit
ffbe0fb56f
1 gewijzigde bestanden met toevoegingen van 22 en 1 verwijderingen
  1. +22
    -1
      inMsg_test.go

+ 22
- 1
inMsg_test.go Bestand weergeven

@@ -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) {
</xml>`
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")

}

Laden…
Annuleren
Opslaan