Commit 702882d0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/dev-phylo-csv-fix' into dev

parents 0087a0f8 843c3f32
...@@ -45,6 +45,8 @@ data CorpusParser = ...@@ -45,6 +45,8 @@ data CorpusParser =
Wos {_wos_limit :: Int} Wos {_wos_limit :: Int}
| Tsv {_tsv_limit :: Int} | Tsv {_tsv_limit :: Int}
| Tsv' {_tsv'_limit :: Int} | Tsv' {_tsv'_limit :: Int}
| Csv {_csv_limit :: Int}
| Csv' {_csv'_limit :: Int}
deriving (Show,Generic,Eq, ToExpr) deriving (Show,Generic,Eq, ToExpr)
instance ToSchema CorpusParser where instance ToSchema CorpusParser where
...@@ -727,6 +729,8 @@ instance Arbitrary CorpusParser where ...@@ -727,6 +729,8 @@ instance Arbitrary CorpusParser where
arbitrary = oneof [ Wos <$> arbitrary arbitrary = oneof [ Wos <$> arbitrary
, Tsv <$> arbitrary , Tsv <$> arbitrary
, Tsv' <$> arbitrary , Tsv' <$> arbitrary
, Csv <$> arbitrary
, Csv' <$> arbitrary
] ]
instance Arbitrary ListParser where instance Arbitrary ListParser where
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ import Data.Text.Lazy as TL ...@@ -13,7 +13,7 @@ import Data.Text.Lazy as TL
import Data.TreeDiff import Data.TreeDiff
import Data.Vector qualified as V import Data.Vector qualified as V
import Gargantext.Core.Text.List.Formats.TSV import Gargantext.Core.Text.List.Formats.TSV
import Gargantext.Core.Types.Phylo import Gargantext.Core.Types.Phylo hiding (Phylo(..))
import Gargantext.Core.Viz.Phylo hiding (EdgeType(..)) import Gargantext.Core.Viz.Phylo hiding (EdgeType(..))
import Gargantext.Core.Viz.Phylo.API.Tools (readPhylo, phylo2dot2json) import Gargantext.Core.Viz.Phylo.API.Tools (readPhylo, phylo2dot2json)
import Gargantext.Core.Viz.Phylo.Example qualified as Cleopatre import Gargantext.Core.Viz.Phylo.Example qualified as Cleopatre
...@@ -69,6 +69,7 @@ tests = testGroup "Phylo" [ ...@@ -69,6 +69,7 @@ tests = testGroup "Phylo" [
, testGroup "relatedComponents" [ , testGroup "relatedComponents" [
testCase "finds simple connection" testRelComp_Connected testCase "finds simple connection" testRelComp_Connected
] ]
, testCase "parses csv phylo" testCsvPhylo
] ]
testCleopatreWithoutLinkExpectedOutput :: Assertion testCleopatreWithoutLinkExpectedOutput :: Assertion
...@@ -248,3 +249,11 @@ testToPhyloDeterminism = do ...@@ -248,3 +249,11 @@ testToPhyloDeterminism = do
let actual = setConfig phyloTestConfig $ toPhylo $ toPhyloWithoutLink corpus config let actual = setConfig phyloTestConfig $ toPhylo $ toPhyloWithoutLink corpus config
expected <- setConfig phyloTestConfig <$> (readPhylo =<< getDataFileName "test-data/phylo/187481.json") expected <- setConfig phyloTestConfig <$> (readPhylo =<< getDataFileName "test-data/phylo/187481.json")
assertBool ("Phylo mismatch! " <> show (ansiWlEditExprCompact $ ediff expected actual)) (expected == actual) assertBool ("Phylo mismatch! " <> show (ansiWlEditExprCompact $ ediff expected actual)) (expected == actual)
testCsvPhylo :: Assertion
testCsvPhylo = do
pth <- getDataFileName "test-data/phylo/cleopatre.golden.csv.json"
phyloJson <- eitherDecodeFileStrict' @Phylo pth
case phyloJson of
Left err -> error err
Right _ -> pure ()
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