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
150
Issues
150
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
2fd9c3e9
Commit
2fd9c3e9
authored
Oct 15, 2024
by
Alfredo Di Napoli
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JSON roundtrip tests
parent
775aab73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
Phylo.hs
src/Gargantext/Core/Viz/Phylo.hs
+16
-0
UTCTime.hs
src/Gargantext/Utils/UTCTime.hs
+7
-3
JSON.hs
test/Test/Offline/JSON.hs
+4
-1
No files found.
src/Gargantext/Core/Viz/Phylo.hs
View file @
2fd9c3e9
...
...
@@ -831,6 +831,22 @@ instance Arbitrary Filter where
instance
Arbitrary
PhyloParam
where
arbitrary
=
pure
defaultPhyloParam
instance
Arbitrary
ComputeTimeHistory
where
arbitrary
=
oneof
[
pure
NoHistoricalDataAvailable
,
ComputeTimeHistory
.
NE
.
fromList
.
getNonEmpty
<$>
arbitrary
]
-- The 'resize' ensure our tests won't take too long as
-- we won't be generating very long lists.
instance
Arbitrary
Phylo
where
arbitrary
=
Phylo
<$>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
<*>
resize
6
arbitrary
--
-- Functions that uses the lenses
--
...
...
src/Gargantext/Utils/UTCTime.hs
View file @
2fd9c3e9
...
...
@@ -17,19 +17,20 @@ Portability : POSIX
module
Gargantext.Utils.UTCTime
where
import
Data.Fixed
(
Fixed
(
..
))
import
Data.Morpheus.Kind
(
SCALAR
)
import
Data.Morpheus.Types
(
GQLType
(
..
),
DecodeScalar
(
..
),
EncodeScalar
(
..
))
import
Data.Morpheus.Types
qualified
as
DMT
import
Data.String
(
fromString
)
import
Data.Swagger
(
ToSchema
(
..
))
import
Data.Text
qualified
as
T
import
Data.Time
(
UTCTime
,
nominalDiffTimeToSeconds
)
import
Data.Time.Clock.POSIX
(
getPOSIXTime
,
POSIXTime
)
import
Data.Time
(
UTCTime
,
nominalDiffTimeToSeconds
)
import
Data.TreeDiff.Class
import
Gargantext.Prelude
import
Gargantext.System.Logging
import
Prelude
(
String
)
import
Data.TreeDiff.Class
import
Data.Fixed
(
Fixed
(
..
))
import
Test.QuickCheck
hiding
(
label
)
newtype
NUTCTime
=
NUTCTime
UTCTime
...
...
@@ -61,6 +62,9 @@ instance ToExpr ElapsedSeconds where
instance
ToSchema
ElapsedSeconds
where
declareNamedSchema
_
=
declareNamedSchema
(
Proxy
@
Int
)
instance
Arbitrary
ElapsedSeconds
where
arbitrary
=
ElapsedSeconds
.
fromInteger
.
getPositive
<$>
arbitrary
timeMeasured
::
(
MonadLogger
m
,
MonadBase
IO
m
,
HasCallStack
)
=>
String
-- ^ A label
...
...
test/Test/Offline/JSON.hs
View file @
2fd9c3e9
...
...
@@ -6,14 +6,15 @@
module
Test.Offline.JSON
(
tests
)
where
import
Data.Aeson
import
Data.ByteString
qualified
as
B
import
Data.ByteString.Lazy.Char8
qualified
as
C8
import
Data.ByteString
qualified
as
B
import
Data.Either
import
Gargantext.API.Errors
import
Gargantext.API.Node.Corpus.Types
import
Gargantext.API.Node.Types
import
Gargantext.API.Viz.Types
import
Gargantext.Core.Types.Phylo
import
qualified
Gargantext.Core.Viz.Phylo
as
VizPhylo
import
Gargantext.Database.Admin.Types.Node
import
Paths_gargantext
import
Prelude
...
...
@@ -62,6 +63,8 @@ tests = testGroup "JSON" [
,
testProperty
"GraphDataData"
(
jsonRoundtrip
@
GraphDataData
)
,
testProperty
"ObjectData"
(
jsonRoundtrip
@
ObjectData
)
,
testProperty
"PhyloData"
(
jsonRoundtrip
@
PhyloData
)
,
testProperty
"ComputeTimeHistory"
(
jsonRoundtrip
@
VizPhylo
.
ComputeTimeHistory
)
,
testProperty
"Phylo"
(
jsonRoundtrip
@
VizPhylo
.
Phylo
)
,
testProperty
"LayerData"
(
jsonRoundtrip
@
LayerData
)
,
testCase
"can parse bpa_phylo_test.json"
testParseBpaPhylo
,
testCase
"can parse open_science.json"
testOpenSciencePhylo
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
83c8708f
·
Nov 07, 2024
mentioned in commit
83c8708f
mentioned in commit 83c8708f08e563243a0ff361e51a46c7d7822bb7
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