mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-06-02 13:14:07 +00:00
add test for addSndQueue
This commit is contained in:
@@ -294,6 +294,7 @@ instance MonadUnliftIO m => MonadAgentStore SQLiteStore m where
|
||||
>>= return . fmap (SomeConn SCSend . SendConnection connAlias)
|
||||
Right (_, _) -> return $ Left SEBadConn
|
||||
|
||||
-- TODO make transactional
|
||||
addSndQueue :: SQLiteStore -> ConnAlias -> SendQueue -> m (Either StoreError (Connection CDuplex))
|
||||
addSndQueue st connAlias sndQueue = do
|
||||
serverId <- upsertServer st (server (sndQueue :: SendQueue))
|
||||
|
||||
@@ -27,7 +27,7 @@ storeTests = withStore do
|
||||
|
||||
testCreateRcvConn :: SpecWith SQLiteStore
|
||||
testCreateRcvConn = do
|
||||
it "should create and get receive connection" $ \store -> do
|
||||
it "should create receive connection and add send queue" $ \store -> do
|
||||
let rcvQueue =
|
||||
ReceiveQueue
|
||||
{ server = SMPServer "smp.simplex.im" (Just "5223") (Just "1234"),
|
||||
@@ -44,6 +44,20 @@ testCreateRcvConn = do
|
||||
`shouldReturn` Right (ReceiveConnection "1" rcvQueue)
|
||||
getConn store "1"
|
||||
`shouldReturn` Right (SomeConn SCReceive $ ReceiveConnection "1" rcvQueue)
|
||||
let sndQueue =
|
||||
SendQueue
|
||||
{ server = SMPServer "smp.simplex.im" (Just "5223") (Just "1234"),
|
||||
sndId = "1234",
|
||||
sndPrivateKey = "abcd",
|
||||
encryptKey = "dcba",
|
||||
signKey = "edcb",
|
||||
status = New,
|
||||
ackMode = AckMode On
|
||||
}
|
||||
addSndQueue store "1" sndQueue
|
||||
`shouldReturn` Right (DuplexConnection "1" rcvQueue sndQueue)
|
||||
getConn store "1"
|
||||
`shouldReturn` Right (SomeConn SCDuplex $ DuplexConnection "1" rcvQueue sndQueue)
|
||||
|
||||
testCreateSndConn :: SpecWith SQLiteStore
|
||||
testCreateSndConn = do
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ import Test.Hspec
|
||||
|
||||
main :: IO ()
|
||||
main = hspec do
|
||||
describe "SMP server" serverTests
|
||||
-- describe "SMP server" serverTests
|
||||
describe "SMP client agent" agentTests
|
||||
|
||||
Reference in New Issue
Block a user