fix: Simplify async update testing
This commit is contained in:
committed by
mrugesh mohapatra
parent
730245e204
commit
1fba44f722
@ -36,9 +36,7 @@ describe('InMemoryCache', () => {
|
|||||||
it('can handle promises correctly', done => {
|
it('can handle promises correctly', done => {
|
||||||
const cache = inMemoryCache(before, reportErrorStub);
|
const cache = inMemoryCache(before, reportErrorStub);
|
||||||
const promisedUpdate = () => new Promise(resolve => resolve(after));
|
const promisedUpdate = () => new Promise(resolve => resolve(after));
|
||||||
cache.update(promisedUpdate);
|
cache.update(promisedUpdate).then(() => {
|
||||||
// because async
|
|
||||||
setImmediate(() => {
|
|
||||||
expect(cache.get()).toBe(after);
|
expect(cache.get()).toBe(after);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user