chore: Tidy up promise handling and testing

This commit is contained in:
Bouncey
2018-12-03 10:33:07 +00:00
committed by mrugesh mohapatra
parent f66e59e20c
commit a1f64f4b77
2 changed files with 10 additions and 12 deletions

View File

@ -35,7 +35,8 @@ describe('InMemoryCache', () => {
it('can handle promises correctly', done => {
const cache = inMemoryCache(before, reportErrorStub);
cache.update(() => new Promise(resolve => resolve(after)));
const promisedUpdate = () => new Promise(resolve => resolve(after));
cache.update(promisedUpdate);
// because async
setImmediate(() => {
expect(cache.get()).toBe(after);