blob: 61302ea107527091a89bed0bf0fd8771faf6ade4 (
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
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"strings"
"testing"
)
func TestCommandJson(t *testing.T) {
command := &Command{Command: NewId(), Suggest: true}
command.AddSuggestion(&SuggestCommand{Suggestion: NewId()})
json := command.ToJson()
result := CommandFromJson(strings.NewReader(json))
if command.Command != result.Command {
t.Fatal("Ids do not match")
}
if command.Suggestions[0].Suggestion != result.Suggestions[0].Suggestion {
t.Fatal("Ids do not match")
}
}
|