module Jerimum.Tests.Unit.PostgreSQL.Types.TextTest
  ( tests
  ) where

import qualified Data.Text                                   as T
import           Jerimum.PostgreSQL.Types.Text
import           Jerimum.Tests.Unit.PostgreSQL.Types.Helpers
import           Test.Tasty
import           Test.Tasty.QuickCheck

tests :: TestTree
tests = testGroup "PostgreSQL.Types.Text" [testCborCodec]

testCborCodec :: TestTree
testCborCodec =
  testGroup
    "cbor codec"
    [ testProperty "identity" $ \s ->
        let t = T.pack s
        in Right t == runDecoder textDecoderV0 (runEncoder $ textEncoderV0 t)
    ]
