Skip to content
Permalink
Browse files

Merge pull request #530 from input-output-hk/rvl/460/jm-tests

Jormungandr test coverage
  • Loading branch information...
KtorZ committed Jul 12, 2019
2 parents 6479a6e + 7aeeaa6 commit 596103bf9ac6c6e1f4d22451d744998ff336c944
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/jormungandr/test/integration/Cardano/Wallet/Jormungandr/NetworkSpec.hs
@@ -185,11 +185,17 @@ spec = do
let jml = Jormungandr.mkJormungandrLayer mgr url
let nonexistent = Hash "cat"
res <- runExceptT (Jormungandr.getDescendantIds jml nonexistent 42)
res `shouldSatisfy` \case
Left (ErrGetDescendantsParentNotFound _) -> True
Left (ErrGetDescendantsNetworkUnreachable _) -> False
Right _ -> False
res `shouldBe` Left (ErrGetDescendantsParentNotFound nonexistent)

it "returns correct error when backend is not started" $ \_ -> do
mgr <- newManager defaultManagerSettings
-- connect with a base URL for which the backend is not started on
let url' = url { baseUrlPort = baseUrlPort url + 5 }
let jml = Jormungandr.mkJormungandrLayer mgr url'
res <- runExceptT (Jormungandr.getBlock jml (Hash "xyzzy"))
res `shouldSatisfy` \case
Left (ErrGetBlockNetworkUnreachable _) -> True
_ -> False

-- NOTE: 'Right ()' just means that the format wasn't obviously wrong.
-- The tx may still be rejected.

0 comments on commit 596103b

Please sign in to comment.
You can’t perform that action at this time.