[test] WithQuery offline test (with EPO constructor)

parent c0fe2e51
Pipeline #7212 passed with stages
in 81 minutes and 13 seconds
......@@ -62,6 +62,7 @@ tests = testGroup "JSON" [
, testProperty "NodePublishPolicy roundtrips" (jsonEnumRoundtrip (Dict @_ @NodePublishPolicy))
, testCase "WithQuery frontend compliance" testWithQueryFrontend
, testCase "WithQuery frontend compliance (PubMed)" testWithQueryFrontendPubMed
, testCase "WithQuery frontend compliance (EPO)" testWithQueryFrontendEPO
, testGroup "Phylo" [
testProperty "PeriodToNode" (jsonRoundtrip @PeriodToNodeData)
, testProperty "GraphData" (jsonRoundtrip @GraphData)
......@@ -88,6 +89,13 @@ testWithQueryFrontendPubMed = do
Left err -> fail $ "JSON instance will break frontend (PubMed)!: JSON decoding returned: " <> err
Right _ -> pure ()
testWithQueryFrontendEPO :: Assertion
testWithQueryFrontendEPO = do
case eitherDecode @WithQuery (C8.pack cannedWithQueryPayloadEPO) of
Left err -> fail $ "JSON instance will break frontend (EPO)!: 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.
......@@ -100,6 +108,13 @@ cannedWithQueryPayload = [r| {"query":"Haskell","node_id":138,"lang":"EN","flowL
cannedWithQueryPayloadPubMed :: String
cannedWithQueryPayloadPubMed = [r| {"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield": { "External": {"db": "PubMed", "api_key": "x"}}} |]
-- 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.
cannedWithQueryPayloadEPO :: String
cannedWithQueryPayloadEPO = [r| {"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield": { "External": {"db": "EPO", "api_user": "user", "api_token": "token"}}} |]
testParseBpaPhylo :: Assertion
testParseBpaPhylo = do
pth <- getDataFileName "test-data/phylo/bpa_phylo_test.json"
......
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