Add failed test for useCallback in shallow renderer test suite · chenesan/react@b2dff28 (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -290,6 +290,22 @@ describe('ReactShallowRenderer with hooks', () => {
290 290 expect(firstResult).toEqual(secondResult);
291 291 });
292 292
293 +it('should work with useCallback', () => {
294 +function SomeComponent() {
295 +const noop = React.useCallback(() => {}, []);
296 +
297 +return (
298 +<div onClick={noop} />
299 +);
300 +}
301 +
302 +const shallowRenderer = createRenderer();
303 +let firstResult = shallowRenderer.render();
304 +let secondResult = shallowRenderer.render();
305 +
306 +expect(firstResult).toEqual(secondResult);
307 +});
308 +
293 309 it('should work with useContext', () => {
294 310 const SomeContext = React.createContext('default');
295 311