I am new to ava.
My CalculationUtils is at webapp\a\b\CalculationUtils.js
I put CalculationUtils.test.js in same folder webapp\a\b\CalculationUtils.test.js
My package.json was in webapp.
**How can I test CalculationUtils.addition() in the test file ?**
What I tried
cd webapp
import add from 'CalculationUtils .js'; or import add from 'Calculation'
t.is(addition(11, 2017, 3), '2018-2');
test('Current Month 2017Nov add 3 months', t => {
// t.plan(2);
t.pass('this assertion passed');
t.is(addition(11, 2017, 3), '2018-2'); // fails
t.is(CalculationUtils.addition(11, 2017, 3), '2018-2'); // fails
});
fail reason: Duplicate declaration "addition"
Here is the snippet code of package.json
"scripts": {
enter code here`"test": "ava a/**/*.test.js --verbose"
};
Thank you.
Aucun commentaire:
Enregistrer un commentaire