react-component / util

Common Utils For React Component
util.vercel.app
MIT License
623 stars 178 forks source link

test: data-only test for pickAttrs #428

Open rkuykendall opened 1 year ago

rkuykendall commented 1 year ago

This use case is used in both rc-dialog and soon in rc-drawer

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
util ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 2, 2023 at 5:33PM (UTC)
rkuykendall commented 1 year ago

Test output:

yarn run v1.22.19
$ rc-test
 PASS  tests/utils.test.js
 PASS  src/test/isEqual.test.ts
  ● Console

    console.error
      Warning: error

       5 |   // Support uglify
       6 |   if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
    >  7 |     console.error(`Warning: ${message}`);
         |             ^
       8 |   }
       9 | }
      10 |

      at console.<anonymous> (node_modules/jest-mock/build/index.js:709:23)
      at error (src/warning.ts:7:13)
      at method (src/warning.ts:28:5)
      at call (src/warning.ts:34:3)
      at Object.<anonymous> (src/test/isEqual.test.ts:100:12)

    console.error
      Warning: Warning: There may be circular references

       5 |   // Support uglify
       6 |   if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
    >  7 |     console.error(`Warning: ${message}`);
         |             ^
       8 |   }
       9 | }
      10 |

      at console.<anonymous> (node_modules/jest-mock/build/index.js:709:23)
      at error (src/warning.ts:7:13)
      at method (src/warning.ts:28:5)
      at call (src/warning.ts:34:3)
      at deepEqual (src/isEqual.ts:15:12)
      at deepEqual (src/isEqual.ts:43:32)
          at Array.every (<anonymous>)
      at every (src/isEqual.ts:43:19)
      at deepEqual (src/isEqual.ts:49:10)
      at Object.<anonymous> (src/test/isEqual.test.ts:103:33)

 PASS  tests/scrollLocker.test.ts
 PASS  tests/dynamicCSS.test.tsx
 PASS  tests/warning.test.js
 PASS  tests/toArray.test.js
 PASS  tests/ref.test.js
 PASS  tests/Portal.test.tsx
 PASS  tests/index.test.js
  ● Console

    console.error
      Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

      44 |       },
      45 |     });
    > 46 |     const c = ReactDOM.render(<C />, div);
         |                        ^
      47 |     c.setState({
      48 |       a: 1,
      49 |     });

      at printWarning (node_modules/react-dom/cjs/react-dom.development.js:86:30)
      at error (node_modules/react-dom/cjs/react-dom.development.js:60:7)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:29670:5)
      at Object.render (tests/index.test.js:46:24)

 PASS  tests/getScrollBarSize.test.ts
 PASS  tests/react.test.tsx
  ● Console

    console.error
      Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

      57 |
      58 | function legacyRender(node: React.ReactElement, container: ContainerType) {
    > 59 |   reactRender(node, container);
         |   ^
      60 | }
      61 |
      62 | /** @private Test usage. Not work in prod */

      at console.<anonymous> (node_modules/jest-mock/build/index.js:709:23)
      at printWarning (node_modules/react-dom/cjs/react-dom.development.js:86:30)
      at error (node_modules/react-dom/cjs/react-dom.development.js:60:7)
      at render (node_modules/react-dom/cjs/react-dom.development.js:29670:5)
      at reactRender (src/React/render.ts:59:3)
      at legacyRender (src/React/render.ts:65:12)
      at tests/react.test.tsx:41:9
      at act (node_modules/react/cjs/react.development.js:2512:16)
      at _callee3$ (tests/react.test.tsx:40:8)
      at call (tests/react.test.tsx:2:1)
      at Generator.tryCatch (tests/react.test.tsx:2:1)
      at Generator._invoke [as next] (tests/react.test.tsx:2:1)
      at asyncGeneratorStep (tests/react.test.tsx:2:1)
      at asyncGeneratorStep (tests/react.test.tsx:2:1)
      at _next (tests/react.test.tsx:2:1)
      at Object.<anonymous> (tests/react.test.tsx:2:1)

 PASS  tests/hooks.test.js
  ● Console

    console.error
      Warning: A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
          at input
          at value (/Users/rkuykendall/projects/util/tests/hooks.test.js:50:19)

      69 |       expect(container.querySelector('.txt').textContent).toEqual('test');
      70 |
    > 71 |       rerender(<FC value={undefined} />);
         |       ^
      72 |       expect(container.querySelector('input').value).toEqual('test');
      73 |       expect(container.querySelector('.txt').textContent).toEqual('');
      74 |     });

      at printWarning (node_modules/react-dom/cjs/react-dom.development.js:86:30)
      at error (node_modules/react-dom/cjs/react-dom.development.js:60:7)
      at updateWrapper (node_modules/react-dom/cjs/react-dom.development.js:1819:7)
      at updateProperties (node_modules/react-dom/cjs/react-dom.development.js:10151:7)
      at commitUpdate (node_modules/react-dom/cjs/react-dom.development.js:11047:3)
      at commitMutationEffectsOnFiber (node_modules/react-dom/cjs/react-dom.development.js:24389:19)
      at recursivelyTraverseMutationEffects (node_modules/react-dom/cjs/react-dom.development.js:24273:7)
      at commitMutationEffectsOnFiber (node_modules/react-dom/cjs/react-dom.development.js:24293:9)
      at recursivelyTraverseMutationEffects (node_modules/react-dom/cjs/react-dom.development.js:24273:7)
      at commitMutationEffectsOnFiber (node_modules/react-dom/cjs/react-dom.development.js:24432:9)
      at commitMutationEffects (node_modules/react-dom/cjs/react-dom.development.js:24243:3)
      at commitRootImpl (node_modules/react-dom/cjs/react-dom.development.js:26810:5)
      at commitRoot (node_modules/react-dom/cjs/react-dom.development.js:26682:5)
      at finishConcurrentRender (node_modules/react-dom/cjs/react-dom.development.js:25981:9)
      at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25809:7)
      at flushActQueue (node_modules/react/cjs/react.development.js:2667:24)
      at act (node_modules/react/cjs/react.development.js:2582:11)
      at node_modules/@testing-library/react/dist/act-compat.js:63:25
      at renderRoot (node_modules/@testing-library/react/dist/pure.js:159:26)
      at rerender (node_modules/@testing-library/react/dist/pure.js:178:7)
      at Object.rerender (tests/hooks.test.js:71:7)

 PASS  tests/switchScrollingEffect.test.ts
 PASS  tests/focus.test.ts
 PASS  tests/findDOMNode.test.tsx
 PASS  tests/raf.test.js
 PASS  tests/omit.test.ts
 PASS  tests/style.test.js
 PASS  tests/setStyle.test.ts
 PASS  tests/debug.test.js
 PASS  tests/domHook.test.js
 PASS  tests/composeProps.test.js
 PASS  tests/contains.test.tsx

Test Suites: 23 passed, 23 total
Tests:       1 skipped, 113 passed, 114 total
Snapshots:   0 total
Time:        1.821 s, estimated 2 s
Ran all test suites.
✨  Done in 2.24s.