Skip to content

Commit

Permalink
Fixed last test but with an unsatisfying solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jan 15, 2021
1 parent 606a93c commit 6e9805c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ describe('InspectedElement', () => {
done();
});

xit('should poll for updates for the currently selected element', async done => {
it('should poll for updates for the currently selected element', async done => {
const Example = () => null;

const container = document.createElement('div');
Expand Down Expand Up @@ -311,7 +311,16 @@ describe('InspectedElement', () => {
false,
);

inspectedElement = null;
// TODO (cache)
// This test only passes if both the check-for-updates poll AND the test renderer.update() call are included below.
// It seems like either one of the two should be sufficient but:
// 1. Running only check-for-updates schedules a transition that React never renders.
// 2. Running only renderer.update() loads stale data (first props)

// Wait for our check-for-updates poll to get the new data.
jest.runOnlyPendingTimers();
await Promise.resolve();

await utils.actAsync(
() =>
renderer.update(
Expand Down

0 comments on commit 6e9805c

Please sign in to comment.