aboutsummaryrefslogtreecommitdiff
path: root/persistence/sessions_test.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-05-05 20:16:38 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-05-05 20:16:38 +0300
commita74e2bcb7d3262073d05aa89140b1d202b7f179d (patch)
tree2f207931cd694c8254dc920f2174c53719e32024 /persistence/sessions_test.go
parenta3f6d5f77402bf4a4d3fa01297f9fd78cc69a3b3 (diff)
Mute/unmute whole chats with no argumentsv1.9.4
Diffstat (limited to 'persistence/sessions_test.go')
-rw-r--r--persistence/sessions_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/persistence/sessions_test.go b/persistence/sessions_test.go
index 0339378..001cfa0 100644
--- a/persistence/sessions_test.go
+++ b/persistence/sessions_test.go
@@ -88,3 +88,31 @@ func TestSessionSetAbsent(t *testing.T) {
t.Error("There shouldn't come a donkey!")
}
}
+
+func TestSessionIgnore(t *testing.T) {
+ session := Session{}
+ if session.IsChatIgnored(3) {
+ t.Error("Shouldn't be ignored yet")
+ }
+ if !session.IgnoreChat(3) {
+ t.Error("Shouldn't have been ignored")
+ }
+ if session.IgnoreChat(3) {
+ t.Error("Shouldn't ignore second time")
+ }
+ if !session.IsChatIgnored(3) {
+ t.Error("Should be ignored already")
+ }
+ if session.IsChatIgnored(-145) {
+ t.Error("Wrong chat is ignored")
+ }
+ if !session.UnignoreChat(3) {
+ t.Error("Should successfully unignore")
+ }
+ if session.UnignoreChat(3) {
+ t.Error("Should unignore second time")
+ }
+ if session.IsChatIgnored(3) {
+ t.Error("Shouldn't be ignored already")
+ }
+}