mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 06:32:59 +00:00
tests: fix group tests
This commit is contained in:
1 parent
9a1d3e4969
commit
a07e60b3bb
2 files changed
+30
-23
No files matched your search
+24
-17
@@ -6282,7 +6282,8 @@ testGroupHistory =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r <- chat <$> getTermLine cath
|
||||
r `shouldContain` [(0, "hello"), (0, "hey!")]
|
||||
let expected = [(0, "hello"), (0, "hey!")]
|
||||
filter (`elem` expected) r `shouldContain` expected
|
||||
|
||||
-- message delivery works after sending history
|
||||
alice #> "#team 1"
|
||||
@@ -6376,7 +6377,8 @@ testGroupHistoryPreferenceOff =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r <- chat <$> getTermLine cath
|
||||
r `shouldContain` [(0, "hello"), (0, "hey!")]
|
||||
let expected = [(0, "hello"), (0, "hey!")]
|
||||
filter (`elem` expected) r `shouldContain` expected
|
||||
|
||||
alice ##> "/set history #team off"
|
||||
alice <## "updated group preferences:"
|
||||
@@ -6641,10 +6643,11 @@ testGroupHistoryMultipleFiles =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r <- chatF <$> getTermLine cath
|
||||
r
|
||||
`shouldContain` [ ((0, "hi alice"), Just $ tmpFile cath "testfile_bob_1"),
|
||||
((0, "hey bob"), Just $ tmpFile cath "testfile_alice_1")
|
||||
]
|
||||
let expected =
|
||||
[ ((0, "hi alice"), Just $ tmpFile cath "testfile_bob_1"),
|
||||
((0, "hey bob"), Just $ tmpFile cath "testfile_alice_1")
|
||||
]
|
||||
filter (`elem` expected) r `shouldContain` expected
|
||||
|
||||
testGroupHistoryFileCancel :: HasCallStack => TestParams -> IO ()
|
||||
testGroupHistoryFileCancel =
|
||||
@@ -6861,14 +6864,15 @@ testGroupHistoryQuotes =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r <- chat' <$> getTermLine cath
|
||||
r
|
||||
`shouldContain` [ ((0, "ALICE"), Nothing),
|
||||
((0, "BOB"), Nothing),
|
||||
((0, "1"), Just (0, "ALICE")),
|
||||
((0, "2"), Just (0, "BOB")),
|
||||
((0, "3"), Just (0, "ALICE")),
|
||||
((0, "4"), Just (0, "BOB"))
|
||||
]
|
||||
let expected =
|
||||
[ ((0, "ALICE"), Nothing),
|
||||
((0, "BOB"), Nothing),
|
||||
((0, "1"), Just (0, "ALICE")),
|
||||
((0, "2"), Just (0, "BOB")),
|
||||
((0, "3"), Just (0, "ALICE")),
|
||||
((0, "4"), Just (0, "BOB"))
|
||||
]
|
||||
filter (`elem` expected) r `shouldContain` expected
|
||||
|
||||
testGroupHistoryDeletedMessage :: HasCallStack => TestParams -> IO ()
|
||||
testGroupHistoryDeletedMessage =
|
||||
@@ -6970,7 +6974,8 @@ testGroupHistoryDisappearingMessage =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r1 <- chat <$> getTermLine cath
|
||||
r1 `shouldContain` [(0, "1"), (0, "2"), (0, "3"), (0, "4")]
|
||||
let expected1 = [(0, "1"), (0, "2"), (0, "3"), (0, "4")]
|
||||
filter (`elem` expected1) r1 `shouldContain` expected1
|
||||
|
||||
threadDelay 11000000
|
||||
concurrentlyN_
|
||||
@@ -6990,7 +6995,8 @@ testGroupHistoryDisappearingMessage =
|
||||
|
||||
cath ##> "/_get chat #1 count=100"
|
||||
r2 <- chat <$> getTermLine cath
|
||||
r2 `shouldContain` [(0, "1"), (0, "4")]
|
||||
let expected2 = [(0, "1"), (0, "4")]
|
||||
filter (`elem` expected2) r2 `shouldContain` expected2
|
||||
r2 `shouldNotContain` [(0, "2")]
|
||||
r2 `shouldNotContain` [(0, "3")]
|
||||
|
||||
@@ -7101,7 +7107,8 @@ testGroupHistoryUnknownMember =
|
||||
|
||||
dan ##> "/_get chat #1 count=100"
|
||||
r <- chat <$> getTermLine dan
|
||||
r `shouldContain` [(0, "hi from alice"), (0, "hi from bob"), (0, "hi from cath")]
|
||||
let expected = [(0, "hi from alice"), (0, "hi from bob"), (0, "hi from cath")]
|
||||
filter (`elem` expected) r `shouldContain` expected
|
||||
|
||||
dan ##> "/ms team"
|
||||
dan
|
||||
|
||||
@@ -916,12 +916,13 @@ testUserBadgeGroupLinkJoiner ps = do
|
||||
memberBadgeHeader alice "team" "bob" `shouldReturn` Just ("R", BSActive)
|
||||
bob ##> "/_start"
|
||||
bob <## "chat started"
|
||||
bob <## "subscribed 1 connections on server localhost"
|
||||
concurrentlyN_
|
||||
[ alice <## "#team: bob joined the group",
|
||||
do
|
||||
bob <## "#team: joining the group..."
|
||||
bob <## "#team: you joined the group"
|
||||
bob
|
||||
<### [ "subscribed 1 connections on server localhost",
|
||||
"#team: joining the group...",
|
||||
"#team: you joined the group"
|
||||
]
|
||||
]
|
||||
memberBadgeHeader alice "team" "bob" `shouldReturn` Just ("CG", BSActive)
|
||||
|
||||
@@ -986,8 +987,7 @@ testUserBadgeInvitedIntroduced ps = do
|
||||
bob <## "chat stopped"
|
||||
cath ##> "/_start"
|
||||
cath <## "chat started"
|
||||
cath <## "subscribed 2 connections on server localhost"
|
||||
cath <## "#team: alice added bob (Bob) to the group (connecting...)"
|
||||
cath <### ["subscribed 2 connections on server localhost", "#team: alice added bob (Bob) to the group (connecting...)"]
|
||||
memberBadgeHeader cath "team" "bob" `shouldReturn` Just ("CG", BSActive)
|
||||
|
||||
testUserBadgeInvitingHost :: HasCallStack => TestParams -> IO ()
|
||||
|
||||
Reference in new issue
Block a user