summaryrefslogtreecommitdiffstats
path: root/api/websocket_test.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-09-27 11:19:50 -0300
committerChristopher Speller <crspeller@gmail.com>2016-09-27 10:19:50 -0400
commit60347559c7fb857bd5afcd93e65b6e220625da79 (patch)
treedd60ee950e12a9c64f82a1d5239d9d3327aa7ae0 /api/websocket_test.go
parentbfca752940a13c874788b0c885d36b2b263bd4fb (diff)
downloadchat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.gz
chat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.bz2
chat-60347559c7fb857bd5afcd93e65b6e220625da79.zip
PLT-3734 Cleaning up shouldSendEvent function (#4024)
* PLT-3734 Cleaning up shouldSendEvent function * Fix LHS unread highlight and jewel mentions
Diffstat (limited to 'api/websocket_test.go')
-rw-r--r--api/websocket_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/api/websocket_test.go b/api/websocket_test.go
index b0dc1e955..be762429a 100644
--- a/api/websocket_test.go
+++ b/api/websocket_test.go
@@ -78,7 +78,10 @@ func TestWebSocketEvent(t *testing.T) {
WebSocketClient.Listen()
- evt1 := model.NewWebSocketEvent(th.BasicTeam.Id, th.BasicChannel.Id, "somerandomid", model.WEBSOCKET_EVENT_TYPING)
+ omitUser := make(map[string]bool, 1)
+ omitUser["somerandomid"] = true
+ evt1 := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_TYPING, "", th.BasicChannel.Id, "", omitUser)
+ evt1.Add("user_id", "somerandomid")
go Publish(evt1)
time.Sleep(300 * time.Millisecond)
@@ -89,7 +92,7 @@ func TestWebSocketEvent(t *testing.T) {
for {
select {
case resp := <-WebSocketClient.EventChannel:
- if resp.Event == model.WEBSOCKET_EVENT_TYPING && resp.UserId == "somerandomid" {
+ if resp.Event == model.WEBSOCKET_EVENT_TYPING && resp.Data["user_id"].(string) == "somerandomid" {
eventHit = true
}
case <-stop:
@@ -106,7 +109,7 @@ func TestWebSocketEvent(t *testing.T) {
t.Fatal("did not receive typing event")
}
- evt2 := model.NewWebSocketEvent(th.BasicTeam.Id, "somerandomid", "somerandomid", model.WEBSOCKET_EVENT_TYPING)
+ evt2 := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_TYPING, "", "somerandomid", "", nil)
go Publish(evt2)
time.Sleep(300 * time.Millisecond)