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
b4b995bf
Verified
Commit
b4b995bf
authored
Nov 29, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tests] fix tests for removal of servant-job
parent
33da4e06
Pipeline
#7064
passed with stages
in 46 minutes and 19 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
36 deletions
+36
-36
Utils.hs
src/Gargantext/Core/Utils.hs
+16
-0
Swagger.hs
src/Gargantext/Core/Utils/Swagger.hs
+1
-12
Routes.hs
test/Test/API/Routes.hs
+1
-2
Instances.hs
test/Test/Instances.hs
+18
-20
Jobs.hs
test/Test/Utils/Jobs.hs
+0
-2
No files found.
src/Gargantext/Core/Utils.hs
View file @
b4b995bf
...
...
@@ -21,6 +21,8 @@ module Gargantext.Core.Utils (
,
randomString
,
groupWithCounts
,
addTuples
,
(
?!
)
,
(
?|
)
)
where
import
Data.List
qualified
as
List
...
...
@@ -30,6 +32,7 @@ import Data.Text qualified as T
import
Gargantext.Core.Utils.Prefix
import
Gargantext.Prelude
import
Prelude
((
!!
))
import
Prelude
qualified
import
System.Random
(
initStdGen
,
uniformR
)
...
...
@@ -71,3 +74,16 @@ groupWithCounts = map f
addTuples
::
(
Num
a
,
Num
b
)
=>
(
a
,
b
)
->
(
a
,
b
)
->
(
a
,
b
)
addTuples
(
a1
,
b1
)
(
a2
,
b2
)
=
(
a1
+
a2
,
b1
+
b2
)
infixr
4
?!
-- Reverse infix form of "fromJust" with a custom error message
(
?!
)
::
Maybe
a
->
Prelude
.
String
->
a
(
?!
)
ma
msg
=
ma
?|
errorTrace
msg
infixr
4
?|
-- Reverse infix form of "fromMaybe"
(
?|
)
::
Maybe
a
->
a
->
a
(
?|
)
=
flip
fromMaybe
src/Gargantext/Core/Utils/Swagger.hs
View file @
b4b995bf
...
...
@@ -19,6 +19,7 @@ import Data.Swagger.Declare qualified as S
import
Data.Swagger.Internal.Schema
qualified
as
S
import
Data.Swagger.Internal.TypeShape
qualified
as
S
import
Data.Text
qualified
as
T
import
Gargantext.Core.Utils
((
?!
))
import
Gargantext.Prelude
import
Prelude
qualified
...
...
@@ -45,15 +46,3 @@ swaggerOptions pref = defaultSchemaOptions
modifier
::
Text
->
Prelude
.
String
->
Prelude
.
String
modifier
pref
field
=
T
.
unpack
$
T
.
stripPrefix
pref
(
T
.
pack
field
)
?!
"Expecting prefix "
<>
T
.
unpack
pref
infixr
4
?!
-- Reverse infix form of "fromJust" with a custom error message
(
?!
)
::
Maybe
a
->
Prelude
.
String
->
a
(
?!
)
ma
msg
=
ma
?|
errorTrace
msg
infixr
4
?|
-- Reverse infix form of "fromMaybe"
(
?|
)
::
Maybe
a
->
a
->
a
(
?|
)
=
flip
fromMaybe
test/Test/API/Routes.hs
View file @
b4b995bf
...
...
@@ -41,6 +41,7 @@ import Gargantext.API.Routes.Named
import
Gargantext.API.Routes.Named.List
(
updateListJSONEp
,
updateListTSVEp
)
import
Gargantext.API.Routes.Named.Node
hiding
(
treeAPI
)
import
Gargantext.API.Routes.Named.Private
hiding
(
tableNgramsAPI
)
import
Gargantext.API.Routes.Named.Publish
(
PublishAPI
(
..
))
import
Gargantext.API.Routes.Named.Publish
(
PublishRequest
(
..
))
import
Gargantext.API.Routes.Named.Table
import
Gargantext.API.Routes.Named.Tree
(
nodeTreeEp
)
...
...
@@ -61,8 +62,6 @@ import Servant.Auth.Client qualified as S
import
Servant.Client
(
ClientM
)
import
Servant.Client.Core
(
RunClient
,
HasClient
(
..
),
Request
)
import
Servant.Client.Generic
(
genericClient
,
AsClientT
)
import
Servant.Job.Async
import
Gargantext.API.Routes.Named.Publish
(
PublishAPI
(
..
))
instance
RunClient
m
=>
HasClient
m
WS
.
WebSocketPending
where
...
...
test/Test/Instances.hs
View file @
b4b995bf
...
...
@@ -56,8 +56,6 @@ import Gargantext.Database.Admin.Types.Hyperdata qualified as Hyperdata
import
Gargantext.Database.Admin.Types.Node
(
NodeId
(
..
),
UserId
(
..
),
NodeType
(
..
))
import
Gargantext.Database.Query.Facet
(
OrderBy
(
..
))
import
Gargantext.Prelude
hiding
(
replace
,
Location
)
import
Servant.Job.Core
qualified
as
SJ
import
Servant.Job.Types
qualified
as
SJ
import
Text.Parsec.Error
(
ParseError
,
Message
(
..
),
newErrorMessage
)
import
Text.Parsec.Pos
import
Test.QuickCheck
...
...
@@ -305,24 +303,24 @@ instance Arbitrary RenameNode where
-- Servant job
instance
Arbitrary
a
=>
Arbitrary
(
SJ
.
JobOutput
a
)
where
arbitrary
=
SJ
.
JobOutput
<$>
arbitrary
instance
Arbitrary
SJ
.
States
where
arbitrary
=
genericArbitrary
instance
Arbitrary
(
SJ
.
ID
'S
J
.
Safe
k
)
where
arbitrary
=
do
_id_type
<-
arbitrary
_id_number
<-
arbitrary
_id_time
<-
arbitrary
_id_token
<-
arbitrary
pure
$
SJ
.
PrivateID
{
..
}
instance
Arbitrary
a
=>
Arbitrary
(
SJ
.
JobStatus
'S
J
.
Safe
a
)
where
arbitrary
=
do
_job_id
<-
arbitrary
_job_log
<-
arbitrary
_job_status
<-
arbitrary
_job_error
<-
arbitrary
pure
$
SJ
.
JobStatus
{
..
}
deriving
instance
Eq
a
=>
Eq
(
SJ
.
JobStatus
'S
J
.
Safe
a
)
--
instance Arbitrary a => Arbitrary (SJ.JobOutput a) where
--
arbitrary = SJ.JobOutput <$> arbitrary
--
instance Arbitrary SJ.States where arbitrary = genericArbitrary
--
instance Arbitrary (SJ.ID 'SJ.Safe k) where
--
arbitrary = do
--
_id_type <- arbitrary
--
_id_number <- arbitrary
--
_id_time <- arbitrary
--
_id_token <- arbitrary
--
pure $ SJ.PrivateID { .. }
--
instance Arbitrary a => Arbitrary (SJ.JobStatus 'SJ.Safe a) where
--
arbitrary = do
--
_job_id <- arbitrary
--
_job_log <- arbitrary
--
_job_status <- arbitrary
--
_job_error <- arbitrary
--
pure $ SJ.JobStatus { .. }
--
deriving instance Eq a => Eq (SJ.JobStatus 'SJ.Safe a)
-- Notifications
...
...
test/Test/Utils/Jobs.hs
View file @
b4b995bf
...
...
@@ -37,8 +37,6 @@ import Gargantext.Utils.Jobs.Monad hiding (withJob)
import
Network.HTTP.Client
(
Manager
)
import
Network.HTTP.Client.TLS
(
newTlsManager
)
import
Prelude
qualified
import
Servant.Job.Core
qualified
as
SJ
import
Servant.Job.Types
qualified
as
SJ
import
System.IO.Unsafe
import
System.Timeout
(
timeout
)
import
Test.Hspec
...
...
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