Commit 4e207779 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[test] fix test-ps

parent f910cd90
......@@ -192,6 +192,14 @@ yarn css # for manual setup
A guide to getting set up with the IDE integration is coming soon, I hope.
### Testing
To run unit tests, just run:
``` shell
test-ps
```
### Note to contributors
Please follow CONTRIBUTING.md
......
......@@ -35,7 +35,8 @@ let
build-purs
echo "Testing"
# yarn pulp browserify --skip-compile -t dist/bundle.js --src-path output
yarn pulp test --src-path output --test-path output
# yarn pulp test --src-path output --test-path output
NODE_PATH=output node -e "require('Test.Main').main();"
'';
in
pkgs.mkShell {
......
......@@ -55,13 +55,12 @@ spec = do
]
, ngrams_scores: Map.fromFoldable [] }
input = "this is a graph about a biography which stops at every candidate"
output = [Tuple "this is a " Nothing
,Tuple " about a biography " Nothing
,Tuple "which" (Just StopTerm)
,Tuple " " Nothing
,Tuple "stops" (Just StopTerm)
,Tuple " at every " Nothing
,Tuple "candidate" (Just CandidateTerm)
output = [ Tuple "this is a graph about a biography " Nothing
, Tuple "which" (Just StopTerm)
, Tuple " " Nothing
, Tuple "stops" (Just StopTerm)
, Tuple " at every " Nothing
, Tuple "candidate" (Just CandidateTerm)
]
highlightNgrams CTabTerms table input `shouldEqual` output
......@@ -74,18 +73,13 @@ spec = do
]
, ngrams_scores: Map.fromFoldable [] }
input = "This is a new state of the"
output = [Tuple "This " Nothing
,Tuple "is" (Just StopTerm)
,Tuple " " Nothing
,Tuple "a" (Just StopTerm)
,Tuple " " Nothing
,Tuple "new" Nothing
,Tuple " " Nothing
,Tuple "state" Nothing
,Tuple " " Nothing
,Tuple "of" (Just StopTerm)
,Tuple " " Nothing
,Tuple "the" Nothing
output = [ Tuple "This " Nothing
, Tuple "is" (Just StopTerm)
, Tuple " " Nothing
, Tuple "a" (Just StopTerm)
, Tuple " new state " Nothing
, Tuple "of" (Just StopTerm)
, Tuple " the" Nothing
]
highlightNgrams CTabTerms table input `shouldEqual` output
......@@ -98,10 +92,24 @@ spec = do
]
, ngrams_scores: Map.fromFoldable [] }
input = "This is from space images"
output = [Tuple "This is " Nothing
,Tuple "from" (Just CandidateTerm)
,Tuple " space " Nothing
,Tuple "images" (Just CandidateTerm)
output = [ Tuple "This is " Nothing
, Tuple "from" (Just CandidateTerm)
, Tuple " space " Nothing
, Tuple "images" (Just CandidateTerm)
]
highlightNgrams CTabTerms table input `shouldEqual` output
it "works when pattern overlaps 3" do
let ngramType = CTabSources
let table = NgramsTable
{ ngrams_repo_elements: Map.fromFoldable [ tnre "fusion" MapTerm ngramType
, tnre "calculate fusion" CandidateTerm ngramType
]
, ngrams_scores: Map.fromFoldable [] }
input = "Model has been used to calculate fusion cross sections"
output = [ Tuple "Model has been used to " Nothing
, Tuple "calculate fusion" (Just CandidateTerm)
, Tuple " sections " Nothing
]
highlightNgrams CTabTerms table input `shouldEqual` output
......@@ -111,8 +119,8 @@ spec = do
{ ngrams_repo_elements: Map.fromFoldable [ tnre "graph" CandidateTerm ngramType ]
, ngrams_scores: Map.fromFoldable [] }
input = "before graph, after"
output = [Tuple "before " Nothing
,Tuple "graph" (Just CandidateTerm)
,Tuple ", after" Nothing
output = [ Tuple "before " Nothing
, Tuple "graph" (Just CandidateTerm)
, Tuple ", after" Nothing
]
highlightNgrams CTabTerms table input `shouldEqual` output
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