Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2017-01-27 12:34:22 -0500
committerMike Gerwitz <gerwitzm@lovullo.com>2017-01-30 00:29:25 -0500
commit282c0acf54d9b21841cbf2c8299ced705765141c (patch)
treed660f2cb637dca5bb8ae7b592898683e3fa791d5
parentb62673791b176f2f06b902f1c576b78cea3fdfa5 (diff)
downloadliza-282c0acf54d9b21841cbf2c8299ced705765141c.tar.gz
liza-282c0acf54d9b21841cbf2c8299ced705765141c.tar.bz2
liza-282c0acf54d9b21841cbf2c8299ced705765141c.zip
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
-rw-r--r--src/store/MemoryStore.js5
-rw-r--r--src/store/Store.js3
-rw-r--r--test/store/MemoryStoreTest.js10
3 files changed, 15 insertions, 3 deletions
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<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 );
},
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<Store>} 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 );
+ } );
} );