Commit b48af3e4 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Add toPhyloWithoutLink test coverage

parent ea514c8b
Pipeline #5650 failed with stages
in 79 minutes and 55 seconds
...@@ -38,6 +38,9 @@ data-files: ...@@ -38,6 +38,9 @@ data-files:
test-data/phylo/bpa_phylo_test.json test-data/phylo/bpa_phylo_test.json
test-data/phylo/open_science.json test-data/phylo/open_science.json
test-data/phylo/issue-290-small.golden.json test-data/phylo/issue-290-small.golden.json
test-data/phylo/small_phylo_docslist.csv
test-data/phylo/small_phylo_ngramslist.csv
test-data/phylo/small-phylo.golden.json
test-data/test_config.ini test-data/test_config.ini
gargantext-cors-settings.toml gargantext-cors-settings.toml
.clippy.dhall .clippy.dhall
...@@ -965,6 +968,7 @@ test-suite garg-test-tasty ...@@ -965,6 +968,7 @@ test-suite garg-test-tasty
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: drivers/tasty/Main.hs main-is: drivers/tasty/Main.hs
other-modules: other-modules:
Common
Test.API.Setup Test.API.Setup
Test.Core.Text Test.Core.Text
Test.Core.Text.Corpus.Query Test.Core.Text.Corpus.Query
...@@ -997,7 +1001,7 @@ test-suite garg-test-tasty ...@@ -997,7 +1001,7 @@ test-suite garg-test-tasty
Test.Utils.Jobs Test.Utils.Jobs
Paths_gargantext Paths_gargantext
hs-source-dirs: hs-source-dirs:
test test bin/gargantext-phylo/Phylo
default-extensions: default-extensions:
DataKinds DataKinds
DeriveGeneric DeriveGeneric
...@@ -1026,6 +1030,8 @@ test-suite garg-test-tasty ...@@ -1026,6 +1030,8 @@ test-suite garg-test-tasty
, conduit ^>= 1.3.4.2 , conduit ^>= 1.3.4.2
, containers ^>= 0.6.5.1 , containers ^>= 0.6.5.1
, crawlerArxiv , crawlerArxiv
, cryptohash
, directory
, duckling ^>= 0.2.0.0 , duckling ^>= 0.2.0.0
, extra ^>= 1.7.9 , extra ^>= 1.7.9
, fast-logger ^>= 3.0.5 , fast-logger ^>= 3.0.5
...@@ -1063,6 +1069,7 @@ test-suite garg-test-tasty ...@@ -1063,6 +1069,7 @@ test-suite garg-test-tasty
, servant-server , servant-server
, shelly >= 1.9 && < 2 , shelly >= 1.9 && < 2
, stm ^>= 2.5.0.1 , stm ^>= 2.5.0.1
, split
, tasty ^>= 1.4.2.1 , tasty ^>= 1.4.2.1
, tasty-hspec , tasty-hspec
, tasty-hunit , tasty-hunit
...@@ -1074,6 +1081,7 @@ test-suite garg-test-tasty ...@@ -1074,6 +1081,7 @@ test-suite garg-test-tasty
, tmp-postgres >= 1.34.1 && < 1.35 , tmp-postgres >= 1.34.1 && < 1.35
, unordered-containers ^>= 0.2.16.0 , unordered-containers ^>= 0.2.16.0
, validity ^>= 0.11.0.1 , validity ^>= 0.11.0.1
, vector
, wai , wai
, wai-extra , wai-extra
, warp , warp
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -5,15 +5,18 @@ ...@@ -5,15 +5,18 @@
module Test.Offline.Phylo (tests) where module Test.Offline.Phylo (tests) where
import Data.Aeson
import Gargantext.Core.Viz.Phylo import Gargantext.Core.Viz.Phylo
import Gargantext.Core.Viz.Phylo.API.Tools (readPhylo) import Gargantext.Core.Viz.Phylo.API.Tools (readPhylo)
import Gargantext.Core.Viz.Phylo.PhyloMaker (toPhylo) import Gargantext.Core.Viz.Phylo.PhyloMaker (toPhylo, toPhyloWithoutLink)
import Gargantext.Core.Viz.Phylo.PhyloTools import Gargantext.Core.Viz.Phylo.PhyloTools
import Prelude import Prelude
import Test.Tasty import Test.Tasty
import Test.Tasty.HUnit import Test.Tasty.HUnit
import Test.Tasty.QuickCheck import Test.Tasty.QuickCheck
import Common
import Paths_gargantext import Paths_gargantext
phyloConfig :: PhyloConfig phyloConfig :: PhyloConfig
...@@ -42,12 +45,34 @@ phyloConfig = PhyloConfig { ...@@ -42,12 +45,34 @@ phyloConfig = PhyloConfig {
tests :: TestTree tests :: TestTree
tests = testGroup "Phylo" [ tests = testGroup "Phylo" [
testGroup "toPhyloWithoutLink" [
testCase "returns expected data" testSmallPhyloWithoutLinkExpectedOutput
]
, testGroup "toPhylo" [
testCase "returns expected data" testSmallPhyloExpectedOutput testCase "returns expected data" testSmallPhyloExpectedOutput
]
, testGroup "relatedComponents" [ , testGroup "relatedComponents" [
testCase "finds simple connection" testRelComp_Connected testCase "finds simple connection" testRelComp_Connected
] ]
] ]
testSmallPhyloWithoutLinkExpectedOutput :: Assertion
testSmallPhyloWithoutLinkExpectedOutput = do
bpaConfig <- getDataFileName "bench-data/phylo/bpa-config.json"
corpusPath' <- getDataFileName "test-data/phylo/small_phylo_docslist.csv"
listPath' <- getDataFileName "test-data/phylo/small_phylo_ngramslist.csv"
(Right config) <- fmap (\pcfg -> pcfg { corpusPath = corpusPath'
, listPath = listPath'
}) <$> (eitherDecodeFileStrict' bpaConfig)
mapList <- fileToList (listParser config) (listPath config)
corpus <- fileToDocsDefault (corpusParser config)
(corpusPath config)
[Year 3 1 5,Month 3 1 5,Week 4 2 5]
mapList
actual <- pure $ toPhyloWithoutLink corpus config
expected <- readPhylo =<< getDataFileName "test-data/phylo/small-phylo.golden.json"
expected @?= actual
testSmallPhyloExpectedOutput :: Assertion testSmallPhyloExpectedOutput :: Assertion
testSmallPhyloExpectedOutput = do testSmallPhyloExpectedOutput = do
issue290PhyloSmall <- setConfig phyloConfig <$> (readPhylo =<< getDataFileName "bench-data/phylo/issue-290-small.json") issue290PhyloSmall <- setConfig phyloConfig <$> (readPhylo =<< getDataFileName "bench-data/phylo/issue-290-small.json")
......
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