Commit afd62649 authored by Robert Knight's avatar Robert Knight

Add missing calls to `act` in `useStoreProxy` tests

Add calls to `act` around proxy method calls that trigger store changes
which in turn schedule deferred updates within Preact components. This
should hopefully fix an issue with flakey tests due to updates being
flushed after the tests have finished executing.
parent 818a6159
......@@ -82,7 +82,10 @@ describe('sidebar/store/use-store', () => {
assert.deepEqual(proxy.getThing('bar'), { id: 'bar' });
// Test proxied action dispatch.
proxy.addThing('baz');
act(() => {
proxy.addThing('baz');
});
assert.calledWith(addThingSpy, 'baz');
});
......@@ -118,8 +121,10 @@ describe('sidebar/store/use-store', () => {
const { proxy } = renderTestComponent();
proxy.addThing('foo');
proxy.addThing('foo');
act(() => {
proxy.addThing('foo');
proxy.addThing('foo');
});
assert.calledTwice(addThingSpy);
assert.calledWith(addThingSpy, 'foo');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment