Skip to content

Commit

Permalink
Add golden test
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Oct 17, 2023
1 parent 0e87ec4 commit 0426095
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,25 @@ hprop_golden_KeyNonExtendedKey_StakeExtendedVerificationKeyShelley =
H.assertFilesExist [outFp]

H.diffFileVsGoldenFile outFp nonExtendedFp

-- | Test that converting a drep extended verification key yields the
-- expected result.
hprop_golden_KeyNonExtendedKey_DRepExtendedVerificationKey :: Property
hprop_golden_KeyNonExtendedKey_DRepExtendedVerificationKey =
propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
extendedKeyFile <- H.noteInputFile "test/cardano-cli-golden/files/input/key/non-extended-keys/extended-drep.vkey"
goldenFile <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-drep.vkey"
outFp <- H.note $ tempDir </> "non-extended-drep.vkey"

H.assertFilesExist [extendedKeyFile]

void $ execCardanoCLI
[ "conway", "key", "non-extended-key"
, "--extended-verification-key-file", extendedKeyFile
, "--verification-key-file", outFp
]

-- Check for existence of the converted signing key file
H.assertFilesExist [outFp]

H.diffFileVsGoldenFile outFp goldenFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "DRepVerificationKey_ed25519",
"description": "",
"cborHex": "5820b0cd9e6e3e274f4f38f55ef274af123cf4600ac0c58294399b7e076175262553"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "DRepExtendedVerificationKey_ed25519_bip32",
"description": "Delegate Representative Verification Key",
"cborHex": "5840b0cd9e6e3e274f4f38f55ef274af123cf4600ac0c58294399b7e076175262553dde8b75f847f2b7e61a8748627292a06d739c8ba8e78ac83e666030d1093fb3e"
}

0 comments on commit 0426095

Please sign in to comment.