git.iko.soy/typeable/bloodhound
on master help sign in
Fix parent child tests for 2.0.
commita8770c09be9b3865557d017dc764b08aa1544207 authorAlistair Bush <alistair.bush@gmail.com> dateTue 23 Aug 2016, 23:11 (10 years ago) parent06dc6f4
1 file changed+21−4
tests/tests.hs+21−4
tests/tests.hs+21−4
@@ -174,15 +174,32 @@ data ParentMapping = ParentMapping deriving (Eq, Show)
174174
175175instance ToJSON ParentMapping where
176176 toJSON ParentMapping =
177− object ["parent" .= Null ]
177+ object ["parent" .=
178+ object ["properties" .=
179+ object [ "user" .= object ["type" .= ("string" :: Text)]
180+ -- Serializing the date as a date is breaking other tests, mysteriously.
181+ -- , "postDate" .= object [ "type" .= ("date" :: Text)
182+ -- , "format" .= ("YYYY-MM-dd`T`HH:mm:ss.SSSZZ" :: Text)]
183+ , "message" .= object ["type" .= ("string" :: Text)]
184+ , "age" .= object ["type" .= ("integer" :: Text)]
185+ , "location" .= object ["type" .= ("geo_point" :: Text)]
186+ ]]]
178187
179188data ChildMapping = ChildMapping deriving (Eq, Show)
180189
181190instance ToJSON ChildMapping where
182191 toJSON ChildMapping =
183192 object ["child" .=
184− object ["_parent" .= object ["type" .= ("parent" :: Text)]]
185− ]
193+ object ["_parent" .= object ["type" .= ("parent" :: Text)]
194+ , "properties" .=
195+ object [ "user" .= object ["type" .= ("string" :: Text)]
196+ -- Serializing the date as a date is breaking other tests, mysteriously.
197+ -- , "postDate" .= object [ "type" .= ("date" :: Text)
198+ -- , "format" .= ("YYYY-MM-dd`T`HH:mm:ss.SSSZZ" :: Text)]
199+ , "message" .= object ["type" .= ("string" :: Text)]
200+ , "age" .= object ["type" .= ("integer" :: Text)]
201+ , "location" .= object ["type" .= ("geo_point" :: Text)]
202+ ]]]
186203
187204data TweetMapping = TweetMapping deriving (Eq, Show)
188205
@@ -924,8 +941,8 @@ main = hspec $ do
924941
925942 it "indexes two documents in a parent/child relationship and checks that the child exists" $ withTestEnv $ do
926943 resetIndex
927− _ <- putMapping testIndex (MappingName "parent") ParentMapping
928944 _ <- putMapping testIndex (MappingName "child") ChildMapping
945+ _ <- putMapping testIndex (MappingName "parent") ParentMapping
929946 _ <- indexDocument testIndex (MappingName "parent") defaultIndexDocumentSettings exampleTweet (DocId "1")
930947 let parent = (Just . DocumentParent . DocId) "1"
931948 ids = IndexDocumentSettings NoVersionControl parent