describe('Tickers Factory:', function() {
var tickersFactory, tickerContainer, tickerType, chartIsReady;
beforeEach(function() {
module('tickersFactory');
});
beforeEach(inject(function(_tickersFactory_) {
tickersFactory = _tickersFactory_;
}));
it('tickersFactory should be defined', function() {
expect(tickersFactory).toBeDefined();
});
});
我正在尝试测试我的tickersFactory
服务是否已定义,我的Jasmine运行正常,但上面的代码会抛出以下错误:
////////////////////////////////////////////////////////////////////////////////
/**
* @name tickersFactory
* @namespace Factories
* @desc Stores the global ticker and ticker type
*/
var tickersFactory = angular
.module('tickersFactory', [])
.factory('TickersFactory', factory);
factory.$inject = [
'$rootScope',
'ApiFactory',
'GetTickersFactory'
];
function factory(
$rootScope,
ApiFactory,
GetTickersFactory) {
/** Init TickersFactory scope */
/** ----------------------------------------------------------------- */
var tickerContainer = {},
tickerType = {},
chartIsReady = false;
var tickersFactory = {
returnChartReady : returnChartReady,
storeTicker : storeTicker,
getTicker : getTicker,
storeTickerType : storeTickerType,
getTickerType : getTickerType,
initTickersPanel : initTickersPanel
};
return tickersFactory;
////////////////////////////////////////////////////////////////////////
function returnChartReady() {
return chartIsReady;
}
答案 0 :(得分:1)
您正在测试的工厂为_TickersFactory_
,因此您需要使用_tickersFactory_
_而不是/domains?where={"account.field_2_filter_by": "myvalue"}
进行注射。
从图像来看,它有点难以辨别,但似乎你得到了Error: $injector:unpr Unknown Provider