How do I mock local variable for a function in a service? Jasmine/Karma tests

后端 未结 1 1203
我在风中等你
我在风中等你 2020-12-19 21:07

An Angular service has several functions. All of them make use of a local variable defined via a var varName at the top of the file.

Is there any way of

1条回答
  •  攒了一身酷
    2020-12-19 22:08

    In short no.

    The simplest way would be to put it on $scope level. Or Maybe as an angularjs constant

    angular constant

    Or if you'r a really crazy dude you can make a script that change the value of the var, but seriously don't do that, it's crazy.

    0 讨论(0)
提交回复
热议问题