Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
bb282d02
Verified
Commit
bb282d02
authored
Jan 14, 2025
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] WithQuery offline test (with EPO constructor)
parent
c0fe2e51
Pipeline
#7212
passed with stages
in 81 minutes and 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
JSON.hs
test/Test/Offline/JSON.hs
+15
-0
No files found.
test/Test/Offline/JSON.hs
View file @
bb282d02
...
...
@@ -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"
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
03b33383
·
Jan 30, 2025
mentioned in commit
03b33383
mentioned in commit 03b33383dd67c1821a4edb4628923cf7bd039d90
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment