From a07e60b3bbda4e9003b7d1e0c53fda02dcc50d46 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:13:22 +0000 Subject: [PATCH] tests: fix group tests --- tests/ChatTests/Groups.hs | 41 ++++++++++++++++++++++--------------- tests/ChatTests/Profiles.hs | 12 +++++------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 81f0f5d9e2..59eda237f1 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -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 diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index db16226989..85cf84e8b3 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -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 ()