Skip to content

Commit e96fe76

Browse files
committed
added test coverage report for #17
joined all test into one for coverage to work better added istambul package added istambul command with html and text report
1 parent a8fd29b commit e96fe76

6 files changed

+385
-376
lines changed

functions/handlers.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ async function handleType(obj, sentence, langRef, src, forces){
4545
}
4646

4747
async function handleVERB(obj, sentence, langRef, src, forces){
48-
//HERE: we are joining prepositions into the previous verb
48+
//join prepositions with the previous verb
4949
let prepIndex = obj.types.findIndex(t => t === 'PREP')
5050
while (prepIndex >= 0) {
5151
obj.types.splice(prepIndex);
5252
obj.words.splice(prepIndex-1, 2, `${obj.words[prepIndex-1]} ${obj.words[prepIndex]}`)
5353
prepIndex = obj.types.findIndex(t => t === 'PREP')
5454
}
55-
/////////////////////////////////////////////////////////
55+
5656
const defaults = await dbGetter.getPersistent(langRef, 'DEFAULTS', {})
5757

5858
const childrenSUBJ = obj.children.filter(c => c.type === 'SUBJ' || c.type === 'NOUN') //HERE: check if include NOUN here is ok
@@ -148,8 +148,7 @@ async function getVERBInfinitive(word, langRef){
148148
} else fullInf.push(w)
149149
i++;
150150
}
151-
return fullInf.join(' ')
152-
151+
return fullInf.join(' ')
153152
}
154153

155154
async function handleNOUN(obj, sentence, langRef, src){

functions/package.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
"start": "npm run shell",
88
"deploy": "firebase deploy --only functions",
99
"logs": "firebase functions:log",
10-
"test": "npm run test-methods && npm run test-prepares && npm run test-dependencies",
11-
"test-methods": "mocha --exit --timeout 5000 --reporter mochawesome --reporter-options reportDir=tests/results/methods tests/methods.test.js",
12-
"test-prepares": "mocha --exit --timeout 5000 --reporter mochawesome --reporter-options reportDir=tests/results/prepares tests/prepares.test.js",
13-
"test-dependencies": "mocha --exit --timeout 5000 --reporter mochawesome --reporter-options reportDir=tests/results/dependencies tests/dependencies.test.js",
14-
"test-handlers": "mocha --exit --timeout 5000 --reporter mochawesome --reporter-options reportDir=tests/results/handlers tests/handlers.test.js"
10+
"test": "nyc --reporter=html --reporter=text mocha --exit --timeout 5000 --reporter mochawesome --reporter-options reportDir=tests/results/methods tests/methods.test.js"
1511
},
1612
"engines": {
1713
"node": "16"
@@ -27,7 +23,8 @@
2723
"chai": "^4.3.7",
2824
"firebase-functions-test": "^0.2.0",
2925
"mocha": "^10.1.0",
30-
"mochawesome": "^7.1.3"
26+
"mochawesome": "^7.1.3",
27+
"nyc": "^15.1.0"
3128
},
3229
"private": true
3330
}

functions/tests/dependencies.test.js

-91
This file was deleted.

functions/tests/handlers.test.js

-135
This file was deleted.

0 commit comments

Comments
 (0)