1
0
Fork 0

Store#clear to return self

* src/store/MemoryStore.js (clear): Promise resolve to self.
* src/store/Store.js (clear): Update docblock.
* test/store/MemoryStoreTest.js: Update test case accordingly.

DEV-2296
master
Mike Gerwitz 2017-01-27 12:34:22 -05:00
parent b62673791b
commit 282c0acf54
3 changed files with 15 additions and 3 deletions

View File

@ -111,13 +111,14 @@ module.exports = Class( 'MemoryStore' )
/**
* Clear all items in store
*
* @return {Promise} promise to clear store
* @return {Promise<Store>} promise to clear store, resolving to self
* (for chaining)
*/
'virtual public clear': function()
{
this._store = {};
return Promise.resolve( true );
return Promise.resolve( this.__inst );
},

View File

@ -65,7 +65,8 @@ module.exports = Interface( 'Store',
/**
* Clear all items in store
*
* @return {Promise} promise to clear store
* @return {Promise<Store>} promise to clear store, resolving to self
* (for chaining)
*/
'public clear': [],

View File

@ -103,6 +103,16 @@ describe( 'store.MemoryStore', () =>
);
} );
} );
it( 'returns self with promise', () =>
{
const sut = Sut();
return expect(
sut.clear()
).to.eventually.equal( sut );
} );
} );