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

Fix ngrams ordering in test outputs

After we rewrote `destroyForest`, it means that in normal conditions we
are going to output roots followed by their nodes (in in-order
ordering), so the test outputs need adjustments.
parent da6ef3eb
...@@ -214,22 +214,23 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do ...@@ -214,22 +214,23 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
eRes <- runClientM (get_table_ngrams token cId APINgrams.Terms listId 50 Nothing (Just MapTerm) Nothing Nothing Nothing Nothing) clientEnv eRes <- runClientM (get_table_ngrams token cId APINgrams.Terms listId 50 Nothing (Just MapTerm) Nothing Nothing Nothing Nothing) clientEnv
eRes `shouldSatisfy` isRight eRes `shouldSatisfy` isRight
let (Right res) = eRes let (Right res) = eRes
-- /NOTA BENE/ The count is 1 because the count applies to roots only.
Just res `shouldBe` JSON.decode [json| {"version":5 Just res `shouldBe` JSON.decode [json| {"version":5
,"count":3 ,"count":1
,"data":[ ,"data":[
{"ngrams":"guitar pedals" {"ngrams":"overdrives"
,"size":1 ,"size":1
,"list":"MapTerm" ,"list":"MapTerm"
,"root":"overdrives"
,"parent":"overdrives"
,"occurrences":[] ,"occurrences":[]
,"children":["tube screamers"] ,"children":["guitar pedals"]
}, },
{"ngrams":"overdrives" {"ngrams":"guitar pedals"
,"size":1 ,"size":1
,"list":"MapTerm" ,"list":"MapTerm"
,"root":"overdrives"
,"parent":"overdrives"
,"occurrences":[] ,"occurrences":[]
,"children":["guitar pedals"] ,"children":["tube screamers"]
}, },
{"ngrams":"tube screamers" {"ngrams":"tube screamers"
,"size":1 ,"size":1
...@@ -309,16 +310,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do ...@@ -309,16 +310,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
-- check that new term is parent of old one -- check that new term is parent of old one
checkNgrams getNgrams [json| {"version": 2 checkNgrams getNgrams [json| {"version": 2
,"count":2 ,"count":1
,"data":[ ,"data":[
{"ngrams":"abelian group"
,"size":2
,"list":"MapTerm"
,"root": "new abelian group"
,"parent": "new abelian group"
,"occurrences":[]
,"children":[]
},
{"ngrams":"new abelian group" {"ngrams":"new abelian group"
,"size":1 ,"size":1
,"list":"MapTerm" ,"list":"MapTerm"
...@@ -326,6 +319,14 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do ...@@ -326,6 +319,14 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
,"parent":null ,"parent":null
,"occurrences":[] ,"occurrences":[]
,"children":["abelian group"] ,"children":["abelian group"]
},
{"ngrams":"abelian group"
,"size":2
,"list":"MapTerm"
,"root": "new abelian group"
,"parent": "new abelian group"
,"occurrences":[]
,"children":[]
} }
] ]
} }
...@@ -341,16 +342,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do ...@@ -341,16 +342,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
-- In essence, this JSON needs to be exactly the same as the previous one, -- In essence, this JSON needs to be exactly the same as the previous one,
-- i.e. important doesn't change the topology. -- i.e. important doesn't change the topology.
checkNgrams getNgrams [json| {"version": 2 checkNgrams getNgrams [json| {"version": 2
,"count":2 ,"count":1
,"data":[ ,"data":[
{"ngrams":"abelian group"
,"size":2
,"list":"MapTerm"
,"root": "new abelian group"
,"parent": "new abelian group"
,"occurrences":[]
,"children":[]
},
{"ngrams":"new abelian group" {"ngrams":"new abelian group"
,"size":1 ,"size":1
,"list":"MapTerm" ,"list":"MapTerm"
...@@ -358,6 +351,14 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do ...@@ -358,6 +351,14 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
,"parent":null ,"parent":null
,"occurrences":[] ,"occurrences":[]
,"children":["abelian group"] ,"children":["abelian group"]
},
{"ngrams":"abelian group"
,"size":2
,"list":"MapTerm"
,"root": "new abelian group"
,"parent": "new abelian group"
,"occurrences":[]
,"children":[]
} }
] ]
} }
......
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