mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
use - as notes name
This commit is contained in:
@@ -194,18 +194,19 @@ testPaginationAllChatTypes =
|
||||
_ts6 <- iso8601Show <$> getCurrentTime
|
||||
|
||||
-- $notes
|
||||
alice #> "$notes psst"
|
||||
alice `send` "/- psst"
|
||||
dropTime <$> getTermLine alice `shouldReturn` "- psst"
|
||||
|
||||
ts7 <- iso8601Show <$> getCurrentTime
|
||||
|
||||
getChats_ alice "count=10" [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice "count=3" [("$notes", "psst"), ("@dan", "hey"), ("#team", "")]
|
||||
getChats_ alice "count=10" [("-", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice "count=3" [("-", "psst"), ("@dan", "hey"), ("#team", "")]
|
||||
getChats_ alice ("after=" <> ts2 <> " count=2") [(":3", ""), ("<@cath", "")]
|
||||
getChats_ alice ("before=" <> ts5 <> " count=2") [("#team", ""), (":3", "")]
|
||||
getChats_ alice ("after=" <> ts3 <> " count=10") [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", "")]
|
||||
getChats_ alice ("after=" <> ts3 <> " count=10") [("-", "psst"), ("@dan", "hey"), ("#team", ""), (":3", "")]
|
||||
getChats_ alice ("before=" <> ts4 <> " count=10") [(":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice ("after=" <> ts1 <> " count=10") [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice ("before=" <> ts7 <> " count=10") [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice ("after=" <> ts1 <> " count=10") [("-", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice ("before=" <> ts7 <> " count=10") [("-", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
|
||||
getChats_ alice ("after=" <> ts7 <> " count=10") []
|
||||
getChats_ alice ("before=" <> ts1 <> " count=10") []
|
||||
|
||||
|
||||
+29
-24
@@ -7,7 +7,7 @@ import ChatClient
|
||||
import ChatTests.Utils
|
||||
import System.Directory (copyFile, doesFileExist)
|
||||
import Test.Hspec
|
||||
import System.FilePath (takeFileName, (</>))
|
||||
import System.FilePath ((</>))
|
||||
import Data.Time (getCurrentTime)
|
||||
import ChatTests.ChatList (getChats_)
|
||||
import Data.Time.Format.ISO8601 (iso8601Show)
|
||||
@@ -25,13 +25,13 @@ testNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
alice ##> "/contacts"
|
||||
-- not a contact
|
||||
|
||||
alice #> "$notes keep in mind"
|
||||
alice /- "keep in mind"
|
||||
alice ##> "/tail"
|
||||
alice <# "$notes keep in mind"
|
||||
alice <# "- keep in mind"
|
||||
alice ##> "/chats"
|
||||
alice <# "$notes keep in mind"
|
||||
alice <# "- keep in mind"
|
||||
alice ##> "/? keep"
|
||||
alice <# "$notes keep in mind"
|
||||
alice <# "- keep in mind"
|
||||
|
||||
alice #$> ("/_read chat $1 from=1 to=100", id, "ok")
|
||||
alice ##> "/_unread chat $1 on"
|
||||
@@ -42,16 +42,16 @@ testNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
alice ##> "/tail"
|
||||
alice ##> "/chats"
|
||||
|
||||
alice #> "$notes ahoy!"
|
||||
alice /- "ahoy!"
|
||||
alice ##> "/_update item $1 1 text Greetings."
|
||||
alice ##> "/tail $notes"
|
||||
alice <# "$notes Greetings."
|
||||
alice ##> "/tail -"
|
||||
alice <# "- Greetings."
|
||||
|
||||
testUserNotes :: FilePath -> IO ()
|
||||
testUserNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
alice #> "$notes keep in mind"
|
||||
alice /- "keep in mind"
|
||||
alice ##> "/tail"
|
||||
alice <# "$notes keep in mind"
|
||||
alice <# "- keep in mind"
|
||||
|
||||
alice ##> "/create user secret"
|
||||
alice <## "user profile: secret"
|
||||
@@ -66,17 +66,17 @@ testUserNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
testPreviewsPagination :: FilePath -> IO ()
|
||||
testPreviewsPagination tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
tsS <- iso8601Show <$> getCurrentTime
|
||||
alice #> "$notes first"
|
||||
alice /- "first"
|
||||
tsM <- iso8601Show <$> getCurrentTime
|
||||
alice #> "$notes last"
|
||||
alice /- "last"
|
||||
tsE <- iso8601Show <$> getCurrentTime
|
||||
|
||||
-- there's only one folder that got updated after tsM and before tsE
|
||||
getChats_ alice "count=3" [("$notes", "last")]
|
||||
getChats_ alice "count=3" [("-", "last")]
|
||||
getChats_ alice ("after=" <> tsE <> " count=10") []
|
||||
getChats_ alice ("after=" <> tsS <> " count=10") [("$notes", "last")]
|
||||
getChats_ alice ("after=" <> tsS <> " count=10") [("-", "last")]
|
||||
getChats_ alice ("before=" <> tsM <> " count=10") []
|
||||
getChats_ alice ("before=" <> tsE <> " count=10") [("$notes", "last")]
|
||||
getChats_ alice ("before=" <> tsE <> " count=10") [("-", "last")]
|
||||
getChats_ alice ("before=" <> tsS <> " count=10") []
|
||||
|
||||
testFiles :: FilePath -> IO ()
|
||||
@@ -88,15 +88,15 @@ testFiles tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
|
||||
-- ui-like upload
|
||||
let source = "./tests/fixtures/test.jpg"
|
||||
let stored = files </> takeFileName source
|
||||
let stored = files </> "test.jpg"
|
||||
copyFile source stored
|
||||
alice ##> "/_create $1 json {\"filePath\": \"test.jpg\", \"msgContent\": {\"text\":\"hi myself\",\"type\":\"image\",\"image\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=\"}}"
|
||||
alice <# "$notes hi myself"
|
||||
alice <# "$notes file 1 (test.jpg)"
|
||||
alice <# "- hi myself"
|
||||
alice <# "- file 1 (test.jpg)"
|
||||
|
||||
alice ##> "/tail"
|
||||
alice <# "$notes hi myself"
|
||||
alice <# "$notes file 1 (test.jpg)"
|
||||
alice <# "- hi myself"
|
||||
alice <# "- file 1 (test.jpg)"
|
||||
|
||||
alice ##> "/_get chat $1 count=100"
|
||||
r <- chatF <$> getTermLine alice
|
||||
@@ -109,15 +109,20 @@ testFiles tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
|
||||
let stored2 = files </> "another_test.jpg"
|
||||
copyFile source stored2
|
||||
alice ##> "/_create $1 json {\"filePath\": \"another_test.jpg\", \"msgContent\": {\"text\":\"\",\"type\":\"image\",\"image\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=\"}}"
|
||||
alice <# "$notes file 2 (another_test.jpg)"
|
||||
alice <# "- file 2 (another_test.jpg)"
|
||||
|
||||
alice ##> "/_delete item $1 2 internal"
|
||||
alice <## "message deleted"
|
||||
doesFileExist stored2 `shouldReturn` False
|
||||
doesFileExist stored `shouldReturn` True
|
||||
|
||||
alice ##> "/clear $notes"
|
||||
alice ##> "/tail"
|
||||
doesFileExist stored `shouldReturn` False
|
||||
alice ##> "/clear -"
|
||||
alice ##> "/fs 1"
|
||||
alice <## "chat db error: SEChatItemNotFoundByFileId {fileId = 1}"
|
||||
alice ##> "/tail"
|
||||
doesFileExist stored `shouldReturn` False
|
||||
|
||||
(/-) :: HasCallStack => TestCC -> String -> IO ()
|
||||
cc /- note = do
|
||||
cc `send` ("/- " <> note)
|
||||
(dropTime <$> getTermLine cc) `shouldReturn` ("- " <> note)
|
||||
|
||||
Reference in New Issue
Block a user