git.iko.soy/typeable/bloodhound
on master help sign in
Fix parent child tests for 2.0.
a8770c0Alistair Bush
tests/tests.hs+21−4
@@ -174,15 +174,32 @@ data ParentMapping = ParentMapping deriving (Eq, Show)
174
174
175instance ToJSON ParentMapping where
175instance ToJSON ParentMapping where
176 toJSON ParentMapping =
176 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+ ]]]
178
187
179data ChildMapping = ChildMapping deriving (Eq, Show)
188data ChildMapping = ChildMapping deriving (Eq, Show)
180
189
181instance ToJSON ChildMapping where
190instance ToJSON ChildMapping where
182 toJSON ChildMapping =
191 toJSON ChildMapping =
183 object ["child" .=
192 object ["child" .=
184− object ["_parent" .= object ["type" .= ("parent" :: Text)]]
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)]
185− ]
202+ ]]]
186
203
187data TweetMapping = TweetMapping deriving (Eq, Show)
204data TweetMapping = TweetMapping deriving (Eq, Show)
188
205
@@ -924,8 +941,8 @@ main = hspec $ do
924
941
925 it "indexes two documents in a parent/child relationship and checks that the child exists" $ withTestEnv $ do
942 it "indexes two documents in a parent/child relationship and checks that the child exists" $ withTestEnv $ do
926 resetIndex
943 resetIndex
927− _ <- putMapping testIndex (MappingName "parent") ParentMapping
928 _ <- putMapping testIndex (MappingName "child") ChildMapping
944 _ <- putMapping testIndex (MappingName "child") ChildMapping
945+ _ <- putMapping testIndex (MappingName "parent") ParentMapping
929 _ <- indexDocument testIndex (MappingName "parent") defaultIndexDocumentSettings exampleTweet (DocId "1")
946 _ <- indexDocument testIndex (MappingName "parent") defaultIndexDocumentSettings exampleTweet (DocId "1")
930 let parent = (Just . DocumentParent . DocId) "1"
947 let parent = (Just . DocumentParent . DocId) "1"
931 ids = IndexDocumentSettings NoVersionControl parent
948 ids = IndexDocumentSettings NoVersionControl parent