Skip to content

Commit

Permalink
Merge pull request #530 from input-output-hk/rvl/460/jm-tests
Browse files Browse the repository at this point in the history
Jormungandr test coverage
  • Loading branch information
KtorZ authored Jul 12, 2019
2 parents 6479a6e + 7aeeaa6 commit 596103b
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 596103b

Please sign in to comment.