add chat pagination test

This commit is contained in:
IC Rainbow 2024-01-03 19:57:49 +02:00
parent 1b99cb44f1
commit 2cee1d3cb2

View File

@ -18,6 +18,7 @@ chatLocalTests = do
it "create folders, add notes, read, search" testNotes
it "switch users" testUserNotes
it "preview pagination for notes" testPreviewsPagination
it "chat pagination" testChatPagination
it "stores files" testFiles
testNotes :: FilePath -> IO ()
@ -79,6 +80,22 @@ testPreviewsPagination tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -
getChats_ alice ("before=" <> tsE <> " count=10") [("-", "last")]
getChats_ alice ("before=" <> tsS <> " count=10") []
testChatPagination :: FilePath -> IO ()
testChatPagination tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
alice /- "hello world"
alice /- "memento mori"
alice /- "knock-knock"
alice /- "who's there?"
alice #$> ("/_get chat $1 count=100", chat, [(1, "hello world"), (1, "memento mori"), (1, "knock-knock"), (1, "who's there?")])
alice #$> ("/_get chat $1 count=1", chat, [(1, "who's there?")])
alice #$> ("/_get chat $1 after=2 count=10", chat, [(1, "knock-knock"), (1, "who's there?")])
alice #$> ("/_get chat $1 after=2 count=2", chat, [(1, "knock-knock"), (1, "who's there?")])
alice #$> ("/_get chat $1 before=3 count=10", chat, [(1, "hello world"), (1, "memento mori")])
alice #$> ("/_get chat $1 before=3 count=2", chat, [(1, "hello world"), (1, "memento mori")])
alice #$> ("/_get chat $1 count=10 search=k-k", chat, [(1, "knock-knock")])
testFiles :: FilePath -> IO ()
testFiles tmp = withNewTestChat tmp "alice" aliceProfile $ \alice -> do
-- setup