-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore onClusterStartup hook for cardano-testnet
- Loading branch information
Showing
4 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module Test.Ctl.Testnet.ClusterParameters | ||
( mkSuite | ||
, runTest | ||
) where | ||
|
||
import Prelude | ||
|
||
import Contract.Log (logDebug') | ||
import Contract.Test (ContractTest, withWallets) | ||
import Contract.Test.Mote (TestPlanM) | ||
import Contract.Test.Testnet (defaultTestnetConfig, testTestnetContracts) | ||
import Ctl.Internal.Contract.Hooks (ClusterParameters) | ||
import Data.Maybe (Maybe(Just)) | ||
import Effect.Aff (Aff) | ||
import Effect.Class (liftEffect) | ||
import Effect.Ref (Ref) | ||
import Effect.Ref as Ref | ||
import Mote (group, test) | ||
import Test.Spec.Assertions (shouldNotEqual) | ||
|
||
runTest :: TestPlanM (Aff Unit) Unit | ||
runTest = do | ||
clusterParamsRef <- | ||
liftEffect $ Ref.new | ||
{ nodeSocketPath: mempty | ||
} | ||
testTestnetContracts | ||
defaultTestnetConfig | ||
{ hooks = defaultTestnetConfig.hooks | ||
{ onClusterStartup = Just (flip Ref.write clusterParamsRef) | ||
} | ||
} | ||
(mkSuite clusterParamsRef) | ||
|
||
mkSuite :: Ref ClusterParameters -> TestPlanM ContractTest Unit | ||
mkSuite ref = do | ||
group "ClusterParameters" do | ||
test "Reading cardano-testnet cluster parameters" do | ||
withWallets unit \_ -> do | ||
clusterParams <- liftEffect $ Ref.read ref | ||
clusterParams.nodeSocketPath `shouldNotEqual` mempty | ||
logDebug' $ "ClusterParameters: " <> show clusterParams | ||
pure unit |