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
93586adc
Verified
Commit
93586adc
authored
Jan 13, 2025
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tests] fix WithQuery frontend serialization test
Also, add WithQuery pubmed test (with api_key)
parent
bc29319c
Pipeline
#7209
passed with stages
in 53 minutes and 36 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
JSON.hs
test/Test/Offline/JSON.hs
+14
-1
No files found.
test/Test/Offline/JSON.hs
View file @
93586adc
...
...
@@ -61,6 +61,7 @@ tests = testGroup "JSON" [
,
testProperty
"NodeType roundtrips"
(
jsonEnumRoundtrip
(
Dict
@
_
@
NodeType
))
,
testProperty
"NodePublishPolicy roundtrips"
(
jsonEnumRoundtrip
(
Dict
@
_
@
NodePublishPolicy
))
,
testCase
"WithQuery frontend compliance"
testWithQueryFrontend
,
testCase
"WithQuery frontend compliance (PubMed)"
testWithQueryFrontendPubMed
,
testGroup
"Phylo"
[
testProperty
"PeriodToNode"
(
jsonRoundtrip
@
PeriodToNodeData
)
,
testProperty
"GraphData"
(
jsonRoundtrip
@
GraphData
)
...
...
@@ -81,11 +82,23 @@ testWithQueryFrontend = do
Left
err
->
fail
$
"JSON instance will break frontend!: JSON decoding returned: "
<>
err
Right
_
->
pure
()
testWithQueryFrontendPubMed
::
Assertion
testWithQueryFrontendPubMed
=
do
case
eitherDecode
@
WithQuery
(
C8
.
pack
cannedWithQueryPayloadPubMed
)
of
Left
err
->
fail
$
"JSON instance will break frontend (PubMed)!: 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": {"db": "Arxiv"}}}
|]
-- 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.
cannedWithQueryPayloadPubMed
::
String
cannedWithQueryPayloadPubMed
=
[
r
|
{"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield": { "External": {"db": "PubMed", "api_key": "x"}}}
|]
testParseBpaPhylo
::
Assertion
testParseBpaPhylo
=
do
...
...
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