Skip to content

Commit

Permalink
core/tests: pattern match instead of head
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Jul 27, 2024
1 parent 41af101 commit 530ca43
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hnix-store-core/tests/Fingerprint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ spec_fingerprint = do
it "allows a successful signature verification" $ do
let msg = Text.encodeUtf8 $ metadataFingerprint def exampleStorePath exampleMetadata
Signature sig' =
head
$ sig
<$> filter (\(NarSignature publicKey _) -> publicKey == "cache.nixos.org-1")
(Set.toList (metadataSigs exampleMetadata))
case
sig
<$> filter (\(NarSignature publicKey _) -> publicKey == "cache.nixos.org-1")
(Set.toList (metadataSigs exampleMetadata))
of
(x:_) -> x
_ -> error "impossible"
sig' `shouldSatisfy` Ed25519.verify pubkey msg

exampleFingerprint :: Text
Expand Down

0 comments on commit 530ca43

Please sign in to comment.