Private method Unit testing with Jasmine

前端 未结 5 1754
情深已故
情深已故 2021-02-04 01:40

I was coding test cases for an angular application using jasmine. But many internal methods are declared as private in the services.

Example:

App.service         


        
5条回答
  •  醉梦人生
    2021-02-04 02:00

    If you want to call your private method you just have to do it like this:

    component["thePrivateMethodName"](parameters);
    

    Where component is your service class or component class.

提交回复
热议问题