summaryrefslogtreecommitdiffstats
path: root/model/message_test.go
blob: eb0c7519303daed42abec8d7fcdfda6d760f4e79 (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
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.

package model

import (
	"strings"
	"testing"
)

func TestMessgaeJson(t *testing.T) {
	m := NewMessage(NewId(), NewId(), NewId(), ACTION_TYPING)
	m.Add("RootId", NewId())
	json := m.ToJson()
	result := MessageFromJson(strings.NewReader(json))

	if m.TeamId != result.TeamId {
		t.Fatal("Ids do not match")
	}

	if m.Props["RootId"] != result.Props["RootId"] {
		t.Fatal("Ids do not match")
	}
}