packages feed

morley-1.2.0: test/Test/Integrational.hs

-- | Tests for integrational testing machinery.
module Test.Integrational
  ( spec_Chain_id
  ) where

import Test.Hspec (Spec, it)

import Michelson.Test
import Michelson.Typed
import Tezos.Core
import Util.Named

spec_Chain_id :: Spec
spec_Chain_id = do
  it "Chain id can be set" $
    integrationalTestExpectation $ do
      let code = DROP `Seq` CHAIN_ID `Seq` NIL `Seq` PAIR
      let contract = FullContract
            { fcCode = code
            , fcParamNotes = starParamNotes @'TUnit
            , fcStoreNotes = starNotes
            }
      let chainId = mkChainIdUnsafe "aaaa"

      contractAddr <-
        tOriginate contract "" (toVal dummyChainId) (toMutez 50)

      setChainId chainId
      tTransfer (#from .! genesisAddress) (#to .! contractAddr)
        minBound DefEpName (toVal ())

      validate . Right $
        tExpectStorageConst contractAddr (toVal chainId)