git.iko.soy/typeable/bloodhound
on master help sign in
Merge pull request #77 from bitemyapp/doc-error-type

Add test for error parsing

commit5b66b7c2ba4f92e5be330ce28d22ea18246bfdd1 authorChris Allen <cma@bitemyapp.com> dateSun 18 Oct 2015, 05:19 (11 years ago) parentc3dbab97d4ffef
1 file changed+5
tests/tests.hs+5
tests/tests.hs+5
@@ -335,6 +335,11 @@ main = hspec $ do
335335 validateStatus resp 200
336336 validateStatus deleteResp 200
337337
338+ describe "error parsing" $ do
339+ it "can parse EsErrors" $ withTestEnv $ do
340+ res <- getDocument (IndexName "bogus") (MappingName "also_bogus") (DocId "bogus_as_well")
341+ let errorResp = eitherDecode (responseBody res)
342+ liftIO (errorResp `shouldBe` Right (EsError 404 "IndexMissingException[[bogus] missing]"))
338343
339344 describe "document API" $ do
340345 it "indexes, gets, and then deletes the generated document" $ withTestEnv $ do