I'm using CacheFactory provided by angular-cache.js git link which I need to mock in order to test my factory. This is the code I'm using in the factory for caching.
var cache = CacheFactory.createCache('documentTypeCache', {
deleteOnExpire: 'aggressive',
recycleFreq: 55 * 60 * 1000,
maxAge: 60 * 60 * 1000,
storageMode: 'sessionStorage'
});
And this is how I'm mocking it in my tests.
mockCacheFactory = function(){
this.createCache = jasmine.createSpy('createCache');
this.$get = function(){};
};
$provide.provider('CacheFactory', mockCacheFactory);
However, the tests fail with: Undefined is not an object which points to CacheFactory.createCache.
I tried googling around but seems like there is not much information available related to angular-cache. Any ideas on how to do this?
Aucun commentaire:
Enregistrer un commentaire