Ver código fonte

Add tests for events

tags/v2.0.0-rc1
9seconds 5 anos atrás
pai
commit
aefa003355
1 arquivos alterados com 22 adições e 0 exclusões
  1. 22
    0
      mtglib/events_test.go

+ 22
- 0
mtglib/events_test.go Ver arquivo

32
 	suite.Equal("CONNID", evt.StreamID())
32
 	suite.Equal("CONNID", evt.StreamID())
33
 }
33
 }
34
 
34
 
35
+func (suite *EventsTestSuite) TestEventConnectedToDC() {
36
+	evt := mtglib.EventConnectedToDC{
37
+		CreatedAt: time.Now(),
38
+		ConnID:    "CONNID",
39
+		RemoteIP:  net.ParseIP("10.0.0.10"),
40
+		DC:        3,
41
+	}
42
+
43
+	suite.Equal("CONNID", evt.StreamID())
44
+}
45
+
46
+func (suite *EventsTestSuite) TestEventTraffic() {
47
+	evt := mtglib.EventTraffic{
48
+		CreatedAt: time.Now(),
49
+		ConnID:    "CONNID",
50
+		Traffic:   3,
51
+		IsRead:    true,
52
+	}
53
+
54
+	suite.Equal("CONNID", evt.StreamID())
55
+}
56
+
35
 func (suite *EventsTestSuite) TestEventConcurrencyLimited() {
57
 func (suite *EventsTestSuite) TestEventConcurrencyLimited() {
36
 	suite.Empty(mtglib.EventConcurrencyLimited{}.StreamID())
58
 	suite.Empty(mtglib.EventConcurrencyLimited{}.StreamID())
37
 }
59
 }

Carregando…
Cancelar
Salvar