From 55d15806fb14b1d98b5ca2770bbbb59e11548c62 Mon Sep 17 00:00:00 2001 From: Jeremy Tymes Date: Tue, 13 Nov 2012 07:33:26 -0500 Subject: 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 --- test/ng/cacheFactorySpec.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/ng/cacheFactorySpec.js b/test/ng/cacheFactorySpec.js index dc68b63d..88e8e523 100644 --- a/test/ng/cacheFactorySpec.js +++ b/test/ng/cacheFactorySpec.js @@ -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'); -- cgit v1.2.3