Skip to content

Commit

Permalink
Enhance test to show that b835af2 is not a solution
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Mar 28, 2024
1 parent 8f35986 commit 3b41b85
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ describe('ReactFlightDOM', () => {
}

const [Posts, resolvePostsData] = makeDelayedText();
const [Photos, resolvePhotosData] = makeDelayedText();
const suspendedChunk = createSuspendedChunk(<p>loading</p>);
const {writable, readable} = getTestStream();
const {pipe} = ReactServerDOMServer.renderToPipeableStream(
Expand Down Expand Up @@ -893,8 +894,9 @@ describe('ReactFlightDOM', () => {
const donePromise = createResolvablePromise();

const value = (
<Suspense fallback={<p>loading posts</p>}>
<Suspense fallback={<p>loading posts and photos</p>}>
<Posts />
<Photos />
</Suspense>
);

Expand All @@ -903,13 +905,14 @@ describe('ReactFlightDOM', () => {
donePromise.resolve({value, done: true});
});

expect(container.innerHTML).toBe('<p>loading posts</p>');
expect(container.innerHTML).toBe('<p>loading posts and photos</p>');

await act(async () => {
await resolvePostsData('posts');
await resolvePhotosData('photos');
});

expect(container.innerHTML).toBe('<div>posts</div>');
expect(container.innerHTML).toBe('<div>posts</div><div>photos</div>');
expect(reportedErrors).toEqual([]);
});

Expand Down

0 comments on commit 3b41b85

Please sign in to comment.