Skip to content

Commit

Permalink
[enzyme-test-suite] [fix] Update test like use cases in React docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lh0x00 authored and ljharb committed Feb 8, 2020
1 parent 2ee41d2 commit 8c254a1
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ describe('shallow', () => {
});

it('finds LazyComponent when render component wrapping lazy component', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<LazyComponent />
Expand All @@ -1780,7 +1780,7 @@ describe('shallow', () => {
});

it('returns suspense and lazy component string when debug() is called', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<LazyComponent />
Expand All @@ -1795,7 +1795,7 @@ describe('shallow', () => {
});

it('renders lazy component when render Suspense without option', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1808,7 +1808,7 @@ describe('shallow', () => {
});

it('returns lazy component string when debug() is called', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1820,7 +1820,7 @@ describe('shallow', () => {
});

it('replaces LazyComponent with Fallback when render Suspense if options.suspenseFallback=true', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1833,7 +1833,7 @@ describe('shallow', () => {
});

it('returns fallback component string when debug() is called if options.suspenseFallback=true', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1845,7 +1845,7 @@ describe('shallow', () => {
});

it('throws if options.suspenseFallback is not boolean or undefined', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<LazyComponent />
Expand All @@ -1855,7 +1855,7 @@ describe('shallow', () => {
});

it('finds fallback after dive into functional component wrapping Suspense', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<LazyComponent />
Expand All @@ -1870,7 +1870,7 @@ describe('shallow', () => {
});

it('replaces nested LazyComponent with Fallback when render Suspense with options.suspenseFallback=true', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1890,7 +1890,8 @@ describe('shallow', () => {
});

it('does not replace LazyComponent with Fallback when render Suspense if options.suspenseFallback = false', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));


const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1903,7 +1904,7 @@ describe('shallow', () => {
});

it('does not replace nested LazyComponent with Fallback when render Suspense if option.suspenseFallback = false', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));

const wrapper = shallow((
<Suspense fallback={<Fallback />}>
Expand All @@ -1923,7 +1924,7 @@ describe('shallow', () => {
});

it('throws when rendering lazy component', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));
expect(() => shallow(<LazyComponent />)).to.throw();
});
});
Expand Down

0 comments on commit 8c254a1

Please sign in to comment.