content: {-# LANGUAGE OverloadedStrings #-}
  
  module Test.Golden.Shelley.Genesis.KeyGenGenesis where
  
  import Control.Monad (void)
  
  import Test.Cardano.CLI.Aeson
  import Test.Cardano.CLI.Util
  
  import Hedgehog (Property)
  import Hedgehog.Extras.Test.Base qualified as H
  import Hedgehog.Extras.Test.File qualified as H
  
  hprop_golden_shelleyGenesisKeyGenGenesis :: Property
  hprop_golden_shelleyGenesisKeyGenGenesis =
    watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
      verificationKeyFile <- noteTempFile tempDir "key-gen.vkey"
      signingKeyFile <- noteTempFile tempDir "key-gen.skey"
  
      void $
        execCardanoCLI
          [ "latest"
          , "genesis"
          , "key-gen-genesis"
          , "--verification-key-file"
          , verificationKeyFile
          , "--signing-key-file"
          , signingKeyFile
          ]
  
      assertHasMappings [("type", "GenesisVerificationKey_ed25519")] verificationKeyFile
      assertHasMappings [("type", "GenesisSigningKey_ed25519")] signingKeyFile
  
      H.assertEndsWithSingleNewline verificationKeyFile
      H.assertEndsWithSingleNewline signingKeyFile
  