From 8239c68cf323e4bb20007d2b456336becead273d Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 25 Feb 2016 12:32:46 -0500 Subject: Refactor and modularize analytics on the client --- store/sql_session_store_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'store/sql_session_store_test.go') diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go index 34d3128a6..9b430eb30 100644 --- a/store/sql_session_store_test.go +++ b/store/sql_session_store_test.go @@ -200,3 +200,28 @@ func TestSessionStoreUpdateLastActivityAt(t *testing.T) { } } + +func TestSessionCount(t *testing.T) { + Setup() + + s1 := model.Session{} + s1.UserId = model.NewId() + s1.TeamId = model.NewId() + Must(store.Session().Save(&s1)) + + if r1 := <-store.Session().AnalyticsSessionCount(""); r1.Err != nil { + t.Fatal(r1.Err) + } else { + if r1.Data.(int64) == 0 { + t.Fatal("should have at least 1 session") + } + } + + if r2 := <-store.Session().AnalyticsSessionCount(s1.TeamId); r2.Err != nil { + t.Fatal(r2.Err) + } else { + if r2.Data.(int64) != 1 { + t.Fatal("should have 1 session") + } + } +} -- cgit v1.2.3-1-g7c22