summaryrefslogtreecommitdiffstats
path: root/model/status_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-18 11:10:03 -0400
committerGitHub <noreply@github.com>2016-07-18 11:10:03 -0400
commitc0ab2636d699c8544ce03a58f61b95cfd66ff7ce (patch)
treec7d07934e0ff1a75aafb097a184ae150888199c0 /model/status_test.go
parent180adc79af3d14de6ce62f6e687a6735db3fe82f (diff)
downloadchat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.tar.gz
chat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.tar.bz2
chat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.zip
PLT-2241 Refactored statuses into a more real-time system (#3573)
* Refactored statuses into a more real-time system * Updated package.json with correct commit and fixed minor bug * Minor updates to statuses based on feedback * When setting status online, update only LastActivityAt if status already exists
Diffstat (limited to 'model/status_test.go')
-rw-r--r--model/status_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/model/status_test.go b/model/status_test.go
new file mode 100644
index 000000000..ccdac53b6
--- /dev/null
+++ b/model/status_test.go
@@ -0,0 +1,27 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestStatus(t *testing.T) {
+ status := Status{NewId(), STATUS_ONLINE, 0}
+ json := status.ToJson()
+ status2 := StatusFromJson(strings.NewReader(json))
+
+ if status.UserId != status2.UserId {
+ t.Fatal("UserId should have matched")
+ }
+
+ if status.Status != status2.Status {
+ t.Fatal("Status should have matched")
+ }
+
+ if status.LastActivityAt != status2.LastActivityAt {
+ t.Fatal("LastActivityAt should have matched")
+ }
+}