Skip to content

Commit

Permalink
add safer tests for other composite hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen committed Jun 17, 2022
1 parent eff36c1 commit 3446694
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ describe('ReactHooksInspectionIntegration', () => {
function Foo(props) {
React.useTransition();
const memoizedValue = React.useMemo(() => 'hello', []);
React.useMemo(() => 'not used', []);
return <div>{memoizedValue}</div>;
}
const renderer = ReactTestRenderer.create(<Foo />);
Expand All @@ -566,6 +567,13 @@ describe('ReactHooksInspectionIntegration', () => {
value: 'hello',
subHooks: [],
},
{
id: 2,
isStateEditable: false,
name: 'Memo',
value: 'not used',
subHooks: [],
},
]);
});

Expand Down Expand Up @@ -1020,6 +1028,7 @@ describe('ReactHooksInspectionIntegration', () => {
() => {},
);
React.useMemo(() => 'memo', []);
React.useMemo(() => 'not used', []);
return <div />;
}
const renderer = ReactTestRenderer.create(<Foo />);
Expand All @@ -1040,6 +1049,13 @@ describe('ReactHooksInspectionIntegration', () => {
value: 'memo',
subHooks: [],
},
{
id: 2,
isStateEditable: false,
name: 'Memo',
value: 'not used',
subHooks: [],
},
]);
});

Expand All @@ -1051,6 +1067,7 @@ describe('ReactHooksInspectionIntegration', () => {
() => 'snapshot',
);
React.useMemo(() => 'memo', []);
React.useMemo(() => 'not used', []);
return value;
}

Expand All @@ -1072,6 +1089,13 @@ describe('ReactHooksInspectionIntegration', () => {
value: 'memo',
subHooks: [],
},
{
id: 2,
isStateEditable: false,
name: 'Memo',
value: 'not used',
subHooks: [],
},
]);
});
});

0 comments on commit 3446694

Please sign in to comment.