better test

This commit is contained in:
spaced4ndy
2025-09-04 16:32:39 +04:00
parent bf48642f5f
commit 80dc5d9022
2 changed files with 28 additions and 7 deletions
+3
View File
@@ -477,6 +477,9 @@ testChat3 = testChatCfgOpts3 testCfg testOpts
testChatCfg3 :: HasCallStack => ChatConfig -> Profile -> Profile -> Profile -> (HasCallStack => TestCC -> TestCC -> TestCC -> IO ()) -> TestParams -> IO ()
testChatCfg3 cfg = testChatCfgOpts3 cfg testOpts
testChatOpts3 :: HasCallStack => ChatOpts -> Profile -> Profile -> Profile -> (HasCallStack => TestCC -> TestCC -> TestCC -> IO ()) -> TestParams -> IO ()
testChatOpts3 = testChatCfgOpts3 testCfg
testChatCfgOpts3 :: HasCallStack => ChatConfig -> ChatOpts -> Profile -> Profile -> Profile -> (HasCallStack => TestCC -> TestCC -> TestCC -> IO ()) -> TestParams -> IO ()
testChatCfgOpts3 cfg opts p1 p2 p3 test = testChatN cfg opts [p1, p2, p3] test_
where
+25 -7
View File
@@ -8046,28 +8046,46 @@ testScopedSupportUnreadStatsOnDelete =
testScopedSupportUnreadStatsCorrectOnOpen :: HasCallStack => TestParams -> IO ()
testScopedSupportUnreadStatsCorrectOnOpen =
testChatOpts2 opts aliceProfile bobProfile $ \alice bob -> do
createGroup2 "team" alice bob
testChatOpts3 opts aliceProfile bobProfile cathProfile $ \alice bob cath -> do
createGroup3' "team" alice (bob, GRMember) (cath, GRModerator)
bob #> "#team (support) 1"
alice <# "#team (support: bob) bob> 1"
[alice, cath] *<# "#team (support: bob) bob> 1"
bob #> "#team (support) 2"
alice <# "#team (support: bob) bob> 2"
[alice, cath] *<# "#team (support: bob) bob> 2"
alice ##> "/member support chats #team"
alice <## "bob (Bob) (id 2): unread: 2, require attention: 2, mentions: 0"
threadDelay 1000000
cath #> "#team (support: bob) 3"
alice <# "#team (support: bob) cath> 3"
bob <# "#team (support) cath> 3"
alice ##> "/member support chats #team"
alice <## "bob (Bob) (id 2): unread: 3, require attention: 0, mentions: 0"
bob #> "#team (support) 4"
[alice, cath] *<# "#team (support: bob) bob> 4"
bob #> "#team (support) 5"
[alice, cath] *<# "#team (support: bob) bob> 5"
alice ##> "/member support chats #team"
alice <## "bob (Bob) (id 2): unread: 5, require attention: 2, mentions: 0"
void $ withCCTransaction alice $ \db ->
DB.execute db "UPDATE group_members SET support_chat_items_member_attention=100 WHERE group_member_id=?" (Only (2 :: Int64))
alice ##> "/member support chats #team"
alice <## "bob (Bob) (id 2): unread: 2, require attention: 100, mentions: 0"
alice <## "bob (Bob) (id 2): unread: 5, require attention: 100, mentions: 0"
alice #$> ("/_get chat #1(_support:2) count=100", chat, [(0, "1"), (0, "2")])
alice #$> ("/_get chat #1(_support:2) count=100", chat, [(0, "1"), (0, "2"), (0, "3"), (0, "4"), (0, "5")])
alice ##> "/member support chats #team"
alice <## "bob (Bob) (id 2): unread: 2, require attention: 2, mentions: 0"
alice <## "bob (Bob) (id 2): unread: 5, require attention: 2, mentions: 0"
where
opts =
testOpts