This commit is contained in:
Evgeny Poberezkin
2024-01-12 15:52:22 +00:00
parent 1a547150ab
commit 8a8e47a91d
3 changed files with 6 additions and 5 deletions

View File

@@ -12,7 +12,6 @@ module Simplex.Chat.Core
)
where
import Control.Concurrent.STM
import Control.Logger.Simple
import Control.Monad
import Control.Monad.Reader

View File

@@ -36,6 +36,7 @@ import Simplex.FileTransfer.Server.Env (XFTPServerConfig (..), defaultFileExpira
import Simplex.Messaging.Agent.Env.SQLite
import Simplex.Messaging.Agent.RetryInterval
import Simplex.Messaging.Agent.Store.SQLite (MigrationConfirmation (..))
import qualified Simplex.Messaging.Agent.Store.SQLite.DB as DB
import Simplex.Messaging.Client (ProtocolClientConfig (..), defaultNetworkConfig)
import Simplex.Messaging.Server (runSMPServerBlocking)
import Simplex.Messaging.Server.Env.STM
@@ -191,7 +192,8 @@ groupLinkViaContactVRange = mkVersionRange 1 2
createTestChat :: FilePath -> ChatConfig -> ChatOpts -> String -> Profile -> IO TestCC
createTestChat tmp cfg opts@ChatOpts {coreOptions = CoreChatOpts {dbKey}} dbPrefix profile = do
Right db@ChatDatabase {chatStore} <- createChatDatabase (tmp </> dbPrefix) dbKey False MCError
Right db@ChatDatabase {chatStore, agentStore} <- createChatDatabase (tmp </> dbPrefix) dbKey False MCError
withTransaction agentStore (`DB.execute_` "INSERT INTO users (user_id) VALUES (1);")
Right user <- withTransaction chatStore $ \db' -> runExceptT $ createUserRecord db' (AgentUserId 1) profile True
startTestChat_ db cfg opts user
@@ -306,8 +308,8 @@ getTermLine cc =
5000000 `timeout` atomically (readTQueue $ termQ cc) >>= \case
Just s -> do
-- remove condition to always echo virtual terminal
when True $ do
-- when (printOutput cc) $ do
-- when True $ do
when (printOutput cc) $ do
name <- userName cc
putStrLn $ name <> ": " <> s
pure s

View File

@@ -29,7 +29,7 @@ import Test.Hspec
chatDirectTests :: SpecWith FilePath
chatDirectTests = do
describe "direct messages" $ do
fdescribe "add contact and send/receive messages" testAddContact
describe "add contact and send/receive messages" testAddContact
it "clear chat with contact" testContactClear
it "deleting contact deletes profile" testDeleteContactDeletesProfile
it "unused contact is deleted silently" testDeleteUnusedContactSilent