fix($cacheFactory): return undefined when removing non-existent entry

Instead of throwning an exception, remove should return undefined when
cache entry to be removed doesn't exist.

Closes #1497
This commit is contained in:
Jeremy Tymes
2012-11-13 07:33:26 -05:00
committed by Igor Minar
parent c0de8fb737
commit 1eb9e22d45
2 changed files with 7 additions and 0 deletions

View File

@@ -89,6 +89,11 @@ describe('$cacheFactory', function() {
}));
it('should return undefined when entry does not exist', inject(function($cacheFactory) {
expect(cache.remove('non-existent')).toBeUndefined();
}));
it('should stringify keys', inject(function($cacheFactory) {
cache.put('123', 'foo');
cache.put(123, 'bar');