-- | Mirrors 'Michelson.Test.Import' module in a Lorentz way.

module Lorentz.Test.Import
  ( testTreesWithContractL
  , specWithContractL
  ) where

import Data.Singletons (SingI)
import Test.Hspec (Spec)
import Test.Tasty (TestTree)

import qualified Lorentz.Base as L
import Michelson.Test.Import (specWithContract, testTreesWithContract)
import Michelson.Typed (ToT)
import qualified Michelson.Untyped as U

-- | Like 'testTreesWithContract' but for Lorentz types.
testTreesWithContractL
  :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack)
  => FilePath -> ((U.Contract, L.Contract cp st) -> IO [TestTree]) -> IO [TestTree]
testTreesWithContractL file testImpl = testTreesWithContract file (testImpl . second L.I)

-- | Like 'specWithContract', but for Lorentz types.
specWithContractL
  :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack)
  => FilePath -> ((U.Contract, L.Contract cp st) -> Spec) -> Spec
specWithContractL file mkSpec = specWithContract file (mkSpec . second L.I)