Commit 05e42831 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Move tests under a single umbrella (tasty)

parent be44a926
......@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
name: gargantext
version: 0.0.6.9.9.6.2
version: 0.0.6.9.9.6.2
synopsis: Search, map, share
description: Please see README.md
category: Data
......@@ -866,6 +866,7 @@ test-suite garg-test
Parsers.Types
Parsers.WOS
Utils.Crypto
Utils.Jobs
Paths_gargantext
hs-source-dirs:
src-test
......@@ -896,6 +897,7 @@ test-suite garg-test
build-depends:
QuickCheck
, aeson
, async
, base
, boolexpr
, bytestring
......@@ -905,11 +907,17 @@ test-suite garg-test
, gargantext
, gargantext-prelude
, hspec
, http-client
, http-client-tls
, mtl
, parsec
, patches-class
, patches-map
, quickcheck-instances
, servant-job
, stm
, tasty
, tasty-hspec
, tasty-hunit
, tasty-quickcheck
, text
......@@ -917,42 +925,3 @@ test-suite garg-test
, unordered-containers
, validity
default-language: Haskell2010
test-suite jobqueue-test
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
tests/queue
default-extensions:
DataKinds
DeriveGeneric
FlexibleContexts
FlexibleInstances
GADTs
GeneralizedNewtypeDeriving
MultiParamTypeClasses
NamedFieldPuns
NoImplicitPrelude
OverloadedStrings
RankNTypes
RecordWildCards
StrictData
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
aeson
, async
, base
, containers
, extra
, gargantext
, hspec
, http-client
, http-client-tls
, mtl
, servant-job
, stm
, text
, time
default-language: Haskell2010
......@@ -494,7 +494,6 @@ executables:
- aeson
- serialise
tests:
garg-test:
main: Main.hs
......@@ -514,47 +513,35 @@ tests:
- -rtsopts
- -with-rtsopts=-N
dependencies:
- QuickCheck
- aeson
- async
- base
- boolexpr
- bytestring
- containers
- duckling
- gargantext
- gargantext-prelude
- hspec
- QuickCheck
- quickcheck-instances
- time
- http-client
- http-client-tls
- mtl
- parsec
- patches-class
- patches-map
- duckling
- quickcheck-instances
- servant-job
- stm
- tasty
- tasty-hspec
- tasty-hunit
- tasty-quickcheck
- text
- time
- unordered-containers
- validity
jobqueue-test:
main: Main.hs
source-dirs: tests/queue
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- aeson
- async
- base
- containers
- gargantext
- mtl
- hspec
- http-client
- http-client-tls
- servant-job
- stm
- time
# garg-doctest:
# main: Main.hs
# source-dirs: src-doctest
......
{-# LANGUAGE OverloadedStrings #-}
module Core.Text.Corpus.Query where
module Core.Text.Corpus.Query (tests) where
import Data.BoolExpr
import Gargantext.Core.Text.Corpus.Query
......@@ -8,9 +8,6 @@ import Prelude
import Test.Tasty
import Test.Tasty.QuickCheck hiding (Positive)
main :: IO ()
main = defaultMain tests
tests :: TestTree
tests = testGroup "Boolean Query Engine" [
testProperty "Parses 'A OR B'" testParse01
......
......@@ -18,8 +18,8 @@ import Gargantext.Prelude
import Gargantext.Core.Utils
-- | Core.Utils tests
test :: IO ()
test = hspec $ do
test :: Spec
test = do
describe "check if groupWithCounts works" $ do
it "simple integer array" $ do
(groupWithCounts [1, 2, 3, 1, 2, 3]) `shouldBe` [(1, 2), (2, 2), (3, 2)]
......
......@@ -30,8 +30,8 @@ myCooc = HashMap.fromList [((NgramsTerm {unNgramsTerm = "gev au"},NgramsTerm {un
test :: IO ()
test = hspec $ do
test :: Spec
test = do
describe "Cross" $ do
let
(distanceMap,_,_) = doSimilarityMap Conditional 0 Weak myCooc
......
......@@ -21,18 +21,32 @@ import qualified Parsers.Date as PD
-- import qualified Graph.Distance as GD
import qualified Graph.Clustering as Graph
import qualified Utils.Crypto as Crypto
import qualified Utils.Jobs as Jobs
import Test.Tasty
import Test.Tasty.Hspec
main :: IO ()
main = do
Utils.test
utilSpec <- testSpec "Utils" Utils.test
clusteringSpec <- testSpec "Graph Clustering" Graph.test
dateParserSpec <- testSpec "Date Parsing" PD.testFromRFC3339
cryptoSpec <- testSpec "Crypto" Crypto.test
nlpSpec <- testSpec "NLP" NLP.test
jobsSpec <- testSpec "Jobs" Jobs.test
defaultMain $ testGroup "Gargantext"
[ utilSpec
, clusteringSpec
, dateParserSpec
, cryptoSpec
, nlpSpec
, jobsSpec
, NgramsQuery.tests
, CorpusQuery.tests
]
-- Occ.parsersTest
-- Lang.ngramsExtractionTest FR
-- Lang.ngramsExtractionTest EN
-- Metrics.main
Graph.test
PD.testFromRFC3339
-- GD.test
Crypto.test
NLP.main
NgramsQuery.main
CorpusQuery.main
......@@ -19,8 +19,8 @@ import Gargantext.Prelude
import Gargantext.Core.Text.Terms.Multi
main :: IO ()
main = hspec $ do
test :: Spec
test = do
describe "Text that should be cleaned before sending it to NLP tools as micro-services." $ do
let text = "This is a url http://cnrs.gargantext.org to be remove and another one www.gargantext.org and digits 343242-2332 to be remove and some to keep: 232 231 33." :: Text
let result = "This is a url to be remove and another one and digits to be remove and some to keep: 232 231 33."
......
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
module Ngrams.Query where
module Ngrams.Query (tests) where
import Control.Monad
import Data.Coerce
......@@ -21,9 +21,6 @@ import Test.Tasty
import Test.Tasty.HUnit
main :: IO ()
main = defaultMain tests
tests :: TestTree
tests = testGroup "Ngrams" [unitTests]
......
......@@ -36,8 +36,8 @@ fromRFC3339Inv :: Either ParseError ZonedTime -> Text
fromRFC3339Inv (Right z) = toRFC3339 z
fromRFC3339Inv (Left pe) = panic . pack $ show pe
testFromRFC3339 :: IO ()
testFromRFC3339 = hspec $ do
testFromRFC3339 :: Spec
testFromRFC3339 = do
describe "Test fromRFC3339: " $ do
it "is the inverse of Duckling's toRFC3339" $ property $
((==) <*> (fromRFC3339 . fromRFC3339Inv)) . Right . looseZonedTimePrecision
......
......@@ -16,11 +16,10 @@ import Test.Hspec
import Gargantext.Prelude
import Gargantext.Prelude.Crypto.Hash
import Gargantext.Prelude.Utils
-- | Crypto Hash tests
test :: IO ()
test = hspec $ do
test :: Spec
test = do
describe "Hash String with frontend works" $ do
let text = "To hash with backend" :: Text
let hashed = "8a69a94d164279af2b7d1443ce08da6184b3d7e815406076e148159c284b53c3" :: Hash
......
......@@ -3,7 +3,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NumericUnderscores #-}
module Main where
module Utils.Jobs (test) where
import Control.Concurrent
import qualified Control.Concurrent.Async as Async
......@@ -54,16 +54,6 @@ addJobToSchedule jobt mvar = do
data Counts = Counts { countAs :: Int, countBs :: Int }
deriving (Eq, Show)
inc, dec :: JobT -> Counts -> Counts
inc A cs = cs { countAs = countAs cs + 1 }
inc B cs = cs { countBs = countBs cs + 1 }
inc C cs = cs
inc D cs = cs
dec A cs = cs { countAs = countAs cs - 1 }
dec B cs = cs { countBs = countBs cs - 1 }
dec C cs = cs
dec D cs = cs
jobDuration, initialDelay :: Int
jobDuration = 100000
initialDelay = 20000
......@@ -194,9 +184,6 @@ testTlsManager :: Manager
testTlsManager = unsafePerformIO newTlsManager
{-# NOINLINE testTlsManager #-}
shouldBeE :: (MonadIO m, HasCallStack, Show a, Eq a) => a -> a -> m ()
shouldBeE a b = liftIO (shouldBe a b)
withJob :: Env
-> (JobHandle MyDummyMonad -> () -> MyDummyMonad ())
-> IO (SJ.JobStatus 'SJ.Safe JobLog)
......@@ -362,8 +349,8 @@ testMarkProgress = do
]
}
main :: IO ()
main = hspec $ do
test :: Spec
test = do
describe "job queue" $ do
it "respects max runners limit" $
testMaxRunners
......
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