vendredi 9 septembre 2016

Does mocha need to import my actual javascript code in order to test it?

I'm new to code testing and I'm trying to test with Mocha some functions I've written in Javascript. The problem is that I'm not sure whether or not I should somehow import my script.js (where my functions are coded) to test/test.js.

If I run random tests like below it passes the test,

describe('Triangle', function(){
    it('should evaluate whether input is number or not', function(){
        var foo = '';
        expect('foo').to.be.NaN;
    });
});

but Triangle is a function in my script.js so I don't know whether or not this is actually testing that file. Or maybe I'm getting this wrong and testing is not actually having the test file and my script linked somehow. Could anybody help? Cheers

Aucun commentaire:

Enregistrer un commentaire