mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-30 18:35:59 +00:00
* JSON encoding of types used in simplex-chat * add field names for JSON encodings, encode all error sum-types as objects (to allow extension)
20 lines
723 B
Haskell
20 lines
723 B
Haskell
module CoreTests.ProtocolErrorTests where
|
|
|
|
import Simplex.Messaging.Agent.Protocol (AgentErrorType)
|
|
import Simplex.Messaging.Parsers (parseAll)
|
|
import Simplex.Messaging.Protocol (ErrorType)
|
|
import Simplex.Messaging.Encoding.String
|
|
import Test.Hspec
|
|
import Test.Hspec.QuickCheck (modifyMaxSuccess)
|
|
import Test.QuickCheck
|
|
|
|
protocolErrorTests :: Spec
|
|
protocolErrorTests = modifyMaxSuccess (const 1000) $ do
|
|
describe "errors parsing / serializing" $ do
|
|
it "should parse SMP protocol errors" . property $ \err ->
|
|
parseAll strP (strEncode err)
|
|
== Right (err :: ErrorType)
|
|
it "should parse SMP agent errors" . property $ \err ->
|
|
parseAll strP (strEncode err)
|
|
== Right (err :: AgentErrorType)
|