summaryrefslogtreecommitdiffstats
path: root/model/command_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-06-14 23:53:32 -0800
committer=Corey Hulen <corey@hulen.com>2015-06-14 23:53:32 -0800
commit56e74239d6b34df8f30ef046f0b0ff4ff0866a71 (patch)
tree044da29848cf0f5c8607eac34de69065171669cf /model/command_test.go
downloadchat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.tar.gz
chat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.tar.bz2
chat-56e74239d6b34df8f30ef046f0b0ff4ff0866a71.zip
first commit
Diffstat (limited to 'model/command_test.go')
-rw-r--r--model/command_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/model/command_test.go b/model/command_test.go
new file mode 100644
index 000000000..e3b732c02
--- /dev/null
+++ b/model/command_test.go
@@ -0,0 +1,25 @@
+// Copyright (c) 2015 Spinpunch, 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")
+ }
+}