Skip to content

Commit 700680a

Browse files
committed
More convoluted test
1 parent 093c8a2 commit 700680a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,11 @@ describe('ReactHooks', () => {
697697
.ReactCurrentDispatcher;
698698

699699
const ThemeContext = createContext('light');
700-
let firstRead;
700+
let firstRead, secondRead;
701701
function App() {
702702
firstRead = ReactCurrentDispatcher.current.readContext(ThemeContext);
703+
useMemo(() => {});
704+
secondRead = ReactCurrentDispatcher.current.readContext(ThemeContext);
703705
return useMemo(() => {
704706
return ReactCurrentDispatcher.current.readContext(ThemeContext);
705707
}, []);
@@ -709,6 +711,7 @@ describe('ReactHooks', () => {
709711
'Context can only be read inside the body of a component',
710712
);
711713
expect(firstRead).toBe('light');
714+
expect(secondRead).toBe('light');
712715
});
713716

714717
it('throws when reading context inside useEffect', () => {

0 commit comments

Comments
 (0)