diff --git a/src/store/MemoryStore.js b/src/store/MemoryStore.js index a055b9f..fccb895 100644 --- a/src/store/MemoryStore.js +++ b/src/store/MemoryStore.js @@ -111,13 +111,14 @@ module.exports = Class( 'MemoryStore' ) /** * Clear all items in store * - * @return {Promise} promise to clear store + * @return {Promise} promise to clear store, resolving to self + * (for chaining) */ 'virtual public clear': function() { this._store = {}; - return Promise.resolve( true ); + return Promise.resolve( this.__inst ); }, diff --git a/src/store/Store.js b/src/store/Store.js index acd96c4..f6f171d 100644 --- a/src/store/Store.js +++ b/src/store/Store.js @@ -65,7 +65,8 @@ module.exports = Interface( 'Store', /** * Clear all items in store * - * @return {Promise} promise to clear store + * @return {Promise} promise to clear store, resolving to self + * (for chaining) */ 'public clear': [], diff --git a/test/store/MemoryStoreTest.js b/test/store/MemoryStoreTest.js index 452dbbb..5dcc332 100644 --- a/test/store/MemoryStoreTest.js +++ b/test/store/MemoryStoreTest.js @@ -103,6 +103,16 @@ describe( 'store.MemoryStore', () => ); } ); } ); + + + it( 'returns self with promise', () => + { + const sut = Sut(); + + return expect( + sut.clear() + ).to.eventually.equal( sut ); + } ); } );