I am trying to run a simple typescript file where I am exporting a function named sum as shown below:
I am writing node script.
function sum(a:number):number{
return a;
}
module.exports.sum=sum;
I don't understand what I did wrong.
I wrote this simple script to understand the unit test case. I thought if this file is running properly then i will go and start basic test case using mocha and chai.
below is my test code:
"use strict"
// Import chai.
let chai = require('chai'),
path = require('path');
chai.should();
let SampleTest = require(path.join(__dirname, '..', 'sample.js'));
describe('Sampletesting', () => {
describe('function sum', function(){
it('should return number', function(){
sum(1).should.equal(1);
})
})
});
Aucun commentaire:
Enregistrer un commentaire