Unitary JavaScript code style testing

I start by testing the javascript module (with Jasmine).

I have experience in unit testing C # code. But given that javascript is a dynamic language, it’s very useful for me to use it and write tests using the expressive power of javascript, for example:

describe('known plugins should be exported', function(){
    var plugins = ['bundle','less','sass','coffee','jsn','minifyCSS','minifyJS','forward','fingerprint'];

    plugins.forEach(function(plugin){
        it('should export plugin named ' + plugin, function(){
            expect(all[plugin]).toBeDefined();
        });
    });
});

As for this kind of unconventional tests, I did not go further than doing such tests (an array with a list of test cases that are very similar)

So I think my question is

Is it good to write such tests, or should I limit myself to a more "statically typed" test device?

+5
source share
1 answer

Great question!

, , . .

JavaScript, , . DI IoC . , ( , ) - .

, , , , . .

, , , ​​ (, ), #.

+3

All Articles