mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 16:25:57 +00:00
fix test for /t
This commit is contained in:
@@ -478,11 +478,13 @@ testGroup2 =
|
||||
alice <# "dan> hi"
|
||||
alice <# "@dan hey"
|
||||
alice ##> "/t 5"
|
||||
alice <# "#club cath> hey"
|
||||
alice <# "#club dan> how is it going?"
|
||||
alice <# "dan> hi"
|
||||
alice <# "#club hello"
|
||||
alice <# "@dan hey"
|
||||
alice -- these strings are expected in any order because of sorting by time
|
||||
<##? [ "#club cath> hey",
|
||||
"#club dan> how is it going?",
|
||||
"#club hello",
|
||||
"dan> hi",
|
||||
"@dan hey"
|
||||
]
|
||||
-- remove member
|
||||
cath ##> "/rm club dan"
|
||||
concurrentlyN_
|
||||
@@ -1919,14 +1921,20 @@ send TestCC {chatController = cc} cmd = atomically $ writeTBQueue (inputQ cc) cm
|
||||
(<##) :: TestCC -> String -> Expectation
|
||||
cc <## line = getTermLine cc `shouldReturn` line
|
||||
|
||||
(<###) :: TestCC -> [String] -> Expectation
|
||||
_ <### [] = pure ()
|
||||
cc <### ls = do
|
||||
line <- getTermLine cc
|
||||
getInAnyOrder :: (String -> String) -> TestCC -> [String] -> Expectation
|
||||
getInAnyOrder _ _ [] = pure ()
|
||||
getInAnyOrder f cc ls = do
|
||||
line <- f <$> getTermLine cc
|
||||
if line `elem` ls
|
||||
then cc <### filter (/= line) ls
|
||||
then getInAnyOrder f cc $ filter (/= line) ls
|
||||
else error $ "unexpected output: " <> line
|
||||
|
||||
(<###) :: TestCC -> [String] -> Expectation
|
||||
(<###) = getInAnyOrder id
|
||||
|
||||
(<##?) :: TestCC -> [String] -> Expectation
|
||||
(<##?) = getInAnyOrder dropTime
|
||||
|
||||
(<#) :: TestCC -> String -> Expectation
|
||||
cc <# line = (dropTime <$> getTermLine cc) `shouldReturn` line
|
||||
|
||||
|
||||
Reference in New Issue
Block a user