我试图使用BardJS创建一个模拟服务,但我发现文档有点缺乏,而且我还是JS单元测试的新手,所以它可能显而易见我错过了但是无论如何......我有以下设置:
beforeEach(function () {
bard.appModule('app.home');
bard.inject('$controller', '$rootScope', 'HomeService', 'BreadcrumbService');
homeService = bard.mockService(HomeService, {});
breadcrumbService = bard.mockService(BreadcrumbService, {});
homeController = $controller('HomeController');
$rootScope.$apply();
});
当我尝试调用BreadcrumbService上的方法时,我收到以下错误:
Error: Expected a spy, but got Function.
有没有人有任何想法?