func TestChannelStoreUpdateLastViewedAt(t *testing.T) { Setup() o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" o1.Name = "a" + model.NewId() + "b" o1.Type = model.CHANNEL_OPEN o1.TotalMsgCount = 25 Must(store.Channel().Save(&o1)) m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) err := (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, m1.UserId)).Err if err != nil { t.Fatal("failed to update", err) } err = (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, "missing id")).Err if err != nil { t.Fatal("failed to update") } }
func TestChannelStoreIncrementMentionCount(t *testing.T) { Setup() o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" o1.Name = "a" + model.NewId() + "b" o1.Type = model.CHANNEL_OPEN o1.TotalMsgCount = 25 Must(store.Channel().Save(&o1)) m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL Must(store.Channel().SaveMember(&m1)) err := (<-store.Channel().IncrementMentionCount(m1.ChannelId, m1.UserId)).Err if err != nil { t.Fatal("failed to update") } err = (<-store.Channel().IncrementMentionCount(m1.ChannelId, "missing id")).Err if err != nil { t.Fatal("failed to update") } err = (<-store.Channel().IncrementMentionCount("missing id", m1.UserId)).Err if err != nil { t.Fatal("failed to update") } err = (<-store.Channel().IncrementMentionCount("missing id", "missing id")).Err if err != nil { t.Fatal("failed to update") } }