作者:卢健波_785 | 来源:互联网 | 2023-09-09 12:08
ImdoingsometestingofAngularcontrollerswithJasmineandspyingonalmostadozenmethods.Is
I'm doing some testing of Angular controllers with Jasmine and spying on almost a dozen methods. Is there any way to consolidate the spy setup? My current setup looks like:
我正在用茉莉花做一些角度控制器的测试,并对近十几种方法进行监视。有没有办法巩固间谍机构?我当前的设置如下:
spyOn(playersService, 'getInfo');
spyOn(playersService, 'getAccounts');
spyOn(playersService, 'getGames');
spyOn(playersService, 'getStatus');
spyOn(playersService, 'getEvents');
spyOn(viewersService, 'getViewers');
spyOn(helpersService, 'formatStats');
spyOn(helpersService, 'formatCounts');
spyOn(helpersService, 'formatValues');
spyOn(PlayerInfoController, 'slideToggle');
spyOn(PlayerInfoController, 'openModal');
This just strikes me as a lot of repeated code.
我觉得这是很多重复的代码。
2 个解决方案