Skip to content

Commit

Permalink
fix: add assertions to test
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Sep 24, 2023
1 parent 8029d17 commit 9334a05
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions compat/test/browser/suspense.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2102,13 +2102,7 @@ describe('suspense', () => {
});

it('originalParent undefined should not crash', () => {
const C = lazy(async () => {
await new Promise(r => setTimeout(r, 1000));
const Comp = () => <p>hello world</p>;
return {
default: Comp
};
});
const [Lazy, resolveLazy] = createLazy();

const App = () => {
const [, setTest] = useState(false);
Expand All @@ -2117,12 +2111,19 @@ describe('suspense', () => {
return (
<Suspense fallback={<div />}>
<div>
<C />
<Lazy />
</div>
</Suspense>
);
};

render(<App />, scratch);
expect(scratch.innerHTML).to.equal('<div></div>');
rerender();

return resolveLazy(() => <p>hello world</p>).then(() => {
rerender();
expect(scratch.innerHTML).to.equal('<div><p>hello world</p></div>');
});
});
});

0 comments on commit 9334a05

Please sign in to comment.