blob: 38603e57781a263e40ee84be24f3c2c8001c275b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"strings"
"testing"
)
func TestClusterMessage(t *testing.T) {
m := ClusterMessage{
Event: CLUSTER_EVENT_PUBLISH,
SendType: CLUSTER_SEND_BEST_EFFORT,
Data: "hello",
}
json := m.ToJson()
result := ClusterMessageFromJson(strings.NewReader(json))
if result.Data != "hello" {
t.Fatal()
}
badresult := ClusterMessageFromJson(strings.NewReader("junk"))
if badresult != nil {
t.Fatal("should not have parsed")
}
}
|