blob: fac455a742c51cd0f835226bc9d78ac4782d3767 (
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
29
30
31
32
33
34
35
36
37
38
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"strings"
"testing"
)
func TestChannelViewJson(t *testing.T) {
o := ChannelView{ChannelId: NewId(), PrevChannelId: NewId()}
json := o.ToJson()
ro := ChannelViewFromJson(strings.NewReader(json))
if o.ChannelId != ro.ChannelId {
t.Fatal("ChannelIdIds do not match")
}
if o.PrevChannelId != ro.PrevChannelId {
t.Fatal("PrevChannelIds do not match")
}
}
func TestChannelViewResponseJson(t *testing.T) {
id := NewId()
o := ChannelViewResponse{Status: "OK", LastViewedAtTimes: map[string]int64{id: 12345}}
json := o.ToJson()
ro := ChannelViewResponseFromJson(strings.NewReader(json))
if o.Status != ro.Status {
t.Fatal("ChannelIdIds do not match")
}
if o.LastViewedAtTimes[id] != ro.LastViewedAtTimes[id] {
t.Fatal("LastViewedAtTimes do not match")
}
}
|