mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
26 lines
571 B
Go
26 lines
571 B
Go
// 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")
|
|
}
|
|
}
|