From 301d46e60ba8722cef90e00c5e399e5339a9fbe4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 3 Feb 2015 15:51:11 -0800 Subject: [PATCH] [Persistence] Add test case Add test case for cache to ensure the same object instance is given for multiple read calls, as this addresses WTD-791. --- .../cache/test/CachingPersistenceDecoratorSpec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/persistence/cache/test/CachingPersistenceDecoratorSpec.js b/platform/persistence/cache/test/CachingPersistenceDecoratorSpec.js index 9f2758a99d..4088fda79e 100644 --- a/platform/persistence/cache/test/CachingPersistenceDecoratorSpec.js +++ b/platform/persistence/cache/test/CachingPersistenceDecoratorSpec.js @@ -77,6 +77,17 @@ define( }); + it("gives a single instance of cached objects", function () { + // Perform two reads + decorator.readObject(testSpace, "someKey", "someValue") + .then(mockCallback); + decorator.readObject(testSpace, "someKey", "someValue") + .then(mockCallback); + + // Results should have been pointer-identical + expect(mockCallback.calls[0].args[0]) + .toBe(mockCallback.calls[1].args[0]); + }); }); } ); \ No newline at end of file