Writing a jasmine test specification for a javascript close function

I have a Javascript function in a view that is enclosed in a closure. Closing returns a function with the same name, and also has some helpers. This is the structure of the method.

this.myMethod = (function () {

    function helperMethod(){
        ....
        return true;
    }
    return function myMethod(args){
        helperMethod();
        manipulate();
    }
}

My question is how to write this Jasmine Unit Test method. How can I call this method?

Using the default method of methods in this case does not work, because it is anonymous.

var view = new myView();

    view.myMethod();

    expect ( true ).toBeTruthy();

Please help with this. I am new to the Jasmine Framework.

+4
source share
1 answer

helperMethod, , . , (myMethod), helperMethod - , , , this helpery .

+1

Source: https://habr.com/ru/post/1544294/


All Articles