git.iko.soy/typeable/bloodhound
on master help sign in
Add test case for missing document parse
d9e8da1Michael Xavier
tests/tests.hs+6
@@ -303,6 +303,12 @@ main = hspec $ do
303 (responseBody docInserted) :: Either String (EsResult Tweet)
303 (responseBody docInserted) :: Either String (EsResult Tweet)
304 liftIO $ (fmap getSource newTweet `shouldBe` Right (Just exampleTweet))
304 liftIO $ (fmap getSource newTweet `shouldBe` Right (Just exampleTweet))
305
305
306+ it "produces a parseable result when looking up a bogus document" $ withTestEnv $ do
307+ doc <- getDocument testIndex testMapping (DocId "bogus")
308+ let noTweet = eitherDecode
309+ (responseBody doc) :: Either String (EsResult Tweet)
310+ liftIO $ fmap foundResult noTweet `shouldBe` Right Nothing
311+
306 it "can use optimistic concurrency control" $ withTestEnv $ do
312 it "can use optimistic concurrency control" $ withTestEnv $ do
307 let ev = ExternalDocVersion minBound
313 let ev = ExternalDocVersion minBound
308 let cfg = defaultIndexDocumentSettings { idsVersionControl = ExternalGT ev }
314 let cfg = defaultIndexDocumentSettings { idsVersionControl = ExternalGT ev }