summaryrefslogtreecommitdiffstats
path: root/store/sql_command_store_test.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-03-02 12:22:11 -0800
committerCorey Hulen <corey@hulen.com>2016-03-02 12:22:11 -0800
commitc52153bf601cee5bc21e9e79efcd1fdd5ef1dac7 (patch)
tree822f5614a031f8d65c3ddca7e3e3dfec1152e053 /store/sql_command_store_test.go
parentcddc9df7c4371e4240d65c6874155e1ce85adff0 (diff)
parentfbb71cab4b4c0289c1f071f9fa2e61b0b0237ece (diff)
downloadchat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.gz
chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.bz2
chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.zip
Merge pull request #2258 from mattermost/plt-1796
PLT-1796 Refactor and modularize analytics on the client
Diffstat (limited to 'store/sql_command_store_test.go')
-rw-r--r--store/sql_command_store_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/store/sql_command_store_test.go b/store/sql_command_store_test.go
index b4610d4aa..644ebc9ae 100644
--- a/store/sql_command_store_test.go
+++ b/store/sql_command_store_test.go
@@ -153,3 +153,31 @@ func TestCommandStoreUpdate(t *testing.T) {
t.Fatal(r2.Err)
}
}
+
+func TestCommandCount(t *testing.T) {
+ Setup()
+
+ o1 := &model.Command{}
+ o1.CreatorId = model.NewId()
+ o1.Method = model.COMMAND_METHOD_POST
+ o1.TeamId = model.NewId()
+ o1.URL = "http://nowhere.com/"
+
+ o1 = (<-store.Command().Save(o1)).Data.(*model.Command)
+
+ if r1 := <-store.Command().AnalyticsCommandCount(""); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(int64) == 0 {
+ t.Fatal("should be at least 1 command")
+ }
+ }
+
+ if r2 := <-store.Command().AnalyticsCommandCount(o1.TeamId); r2.Err != nil {
+ t.Fatal(r2.Err)
+ } else {
+ if r2.Data.(int64) != 1 {
+ t.Fatal("should be 1 command")
+ }
+ }
+}