module Freckle.App.Test.Properties.PersistValue
  ( prop_roundTripPersistValue
  ) where

import Freckle.App.Prelude

import Database.Persist (PersistField (..))

-- | Check that @'fromPersistValue' ('toPersistValue' value)@ is @value@
prop_roundTripPersistValue :: (PersistField a, Eq a) => a -> Bool
prop_roundTripPersistValue :: forall a. (PersistField a, Eq a) => a -> Bool
prop_roundTripPersistValue a
a = PersistValue -> Either Text a
forall a. PersistField a => PersistValue -> Either Text a
fromPersistValue (a -> PersistValue
forall a. PersistField a => a -> PersistValue
toPersistValue a
a) Either Text a -> Either Text a -> Bool
forall a. Eq a => a -> a -> Bool
== a -> Either Text a
forall a b. b -> Either a b
Right a
a