Skip to content

Commit

Permalink
Wrap Posts in Suspense to differentiate test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Mar 25, 2024
1 parent 84a9438 commit 36f7400
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -891,14 +891,19 @@ describe('ReactFlightDOM', () => {
expect(container.innerHTML).toBe('<p>loading</p>');

const donePromise = createResolvablePromise();
const value = <Posts />;

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

await act(async () => {
suspendedChunk.resolve({value, done: false, next: donePromise.promise});
donePromise.resolve({value, done: true});
});

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

await act(async () => {
await resolvePostsData('posts');
Expand Down

0 comments on commit 36f7400

Please sign in to comment.