remove folder names, deletion, add autocreate

This commit is contained in:
IC Rainbow
2023-12-28 22:01:35 +02:00
parent 94fb992b4c
commit dc8895c50c
10 changed files with 57 additions and 140 deletions
+6 -8
View File
@@ -194,20 +194,18 @@ testPaginationAllChatTypes =
_ts6 <- iso8601Show <$> getCurrentTime
-- $notes
alice ##> "/note folder self"
alice <## "new note folder created, use $self to create a note"
alice #> "$self psst"
alice #> "$notes psst"
ts7 <- iso8601Show <$> getCurrentTime
getChats_ alice "count=10" [("$self", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
getChats_ alice "count=3" [("$self", "psst"), ("@dan", "hey"), ("#team", "")]
getChats_ alice "count=10" [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
getChats_ alice "count=3" [("$notes", "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") [("$self", "psst"), ("@dan", "hey"), ("#team", ""), (":3", "")]
getChats_ alice ("after=" <> ts3 <> " count=10") [("$notes", "psst"), ("@dan", "hey"), ("#team", ""), (":3", "")]
getChats_ alice ("before=" <> ts4 <> " count=10") [(":3", ""), ("<@cath", ""), ("@bob", "hey")]
getChats_ alice ("after=" <> ts1 <> " count=10") [("$self", "psst"), ("@dan", "hey"), ("#team", ""), (":3", ""), ("<@cath", ""), ("@bob", "hey")]
getChats_ alice ("before=" <> ts7 <> " count=10") [("$self", "psst"), ("@dan", "hey"), ("#team", ""), (":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=" <> ts7 <> " count=10") []
getChats_ alice ("before=" <> ts1 <> " count=10") []
+14 -24
View File
@@ -17,18 +17,18 @@ chatLocalTests = do
testNotes :: FilePath -> IO ()
testNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
createFolder alice "self"
-- createFolder alice "self"
alice ##> "/contacts"
-- not a contact
alice #> "$self keep in mind"
alice #> "$notes keep in mind"
alice ##> "/tail"
alice <# "$self keep in mind"
alice <# "$notes keep in mind"
alice ##> "/chats"
alice <# "$self keep in mind"
alice <# "$notes keep in mind"
alice ##> "/? keep"
alice <# "$self keep in mind"
alice <# "$notes keep in mind"
alice #$> ("/_read chat $1 from=1 to=100", id, "ok")
alice ##> "/_unread chat $1 on"
@@ -39,28 +39,23 @@ testNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
alice ##> "/tail"
alice ##> "/chats"
alice #> "$self ahoy!"
alice #> "$notes ahoy!"
alice ##> "/_update item $1 1 text Greetings."
alice ##> "/tail $self"
alice <# "$self Greetings."
alice ##> "/delete $self"
alice <## "note folder self deleted"
alice ##> "/tail $notes"
alice <# "$notes Greetings."
testUserNotes :: FilePath -> IO ()
testUserNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
createFolder alice "self"
alice #> "$self keep in mind"
alice #> "$notes keep in mind"
alice ##> "/tail"
alice <# "$self keep in mind"
alice <# "$notes keep in mind"
alice ##> "/create user secret"
alice <## "user profile: secret"
alice <## "use /p <display name> to change it"
alice <## "(the updated profile will be sent to all your contacts)"
createFolder alice "gossip"
alice ##> "/tail"
alice ##> "/_delete item $1 1 internal"
@@ -68,22 +63,17 @@ testUserNotes tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
testFiles :: FilePath -> IO ()
testFiles tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
createFolder alice "self"
-- createFolder alice "self"
alice #$> ("/_files_folder ./tests/tmp/app_files", id, "ok")
copyFile "./tests/fixtures/test.jpg" "./tests/tmp/app_files/test.jpg"
alice ##> "/_create $1 json {\"filePath\": \"test.jpg\", \"msgContent\": {\"text\":\"\",\"type\":\"image\",\"image\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=\"}}"
alice <# "$self file 1 (test.jpg)"
alice <# "$notes file 1 (test.jpg)"
alice ##> "/tail"
alice <# "$self file 1 (test.jpg)"
alice <# "$notes file 1 (test.jpg)"
alice ##> "/fs 1"
alice <## "local file 1 (test.jpg)"
alice ##> "/clear $self"
alice ##> "/clear $notes"
alice ##> "/fs 1"
alice <## "chat db error: SEChatItemNotFoundByFileId {fileId = 1}"
createFolder :: TestCC -> String -> IO ()
createFolder cc label = do
cc ##> ("/note folder " <> label)
cc <## ("new note folder created, use $" <> label <> " to create a note")