Commit a1f1f091 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Fix testWithQueryFrontend test

This commit fixes the `testWithQueryFrontend` test, which was broken by

6bc41d73

However, this was followed by a frontend fix, which was modified to deal
with the next format:

purescript-gargantext!374 (diffs)

Therefore, it's fine to fix the test here.
parent 4d10aa95
Pipeline #4362 passed with stage
in 25 seconds
......@@ -44,14 +44,15 @@ tests = testGroup "JSON" [
testWithQueryFrontend :: Assertion
testWithQueryFrontend = do
assertBool "JSON instance will break frontend!"
(isRight $ eitherDecode @WithQuery (C8.pack cannedWithQueryPayload))
case eitherDecode @WithQuery (C8.pack cannedWithQueryPayload) of
Left err -> fail $ "JSON instance will break frontend!: JSON decoding returned: " <> err
Right _ -> pure ()
-- The aim of this type is to catch regressions in the frontend serialisation; this
-- is what the frontend currently expects, and therefore if we were to change the JSON
-- instances, this test would fail, and we will be notified.
cannedWithQueryPayload :: String
cannedWithQueryPayload = [r| {"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield":"External Arxiv","databases":"Arxiv"} |]
cannedWithQueryPayload = [r| {"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield": { "External": "Arxiv"},"databases":"Arxiv"} |]
testParseBpaPhylo :: Assertion
testParseBpaPhylo = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment