1

I wrote a tooltip using popperjs 2.2.1, and jest/enzyme tests. However, I get the following error:

Error: Cannot read property 'split' of undefined

console.error ../../node_modules/@popperjs/core/dist/cjs/popper.js:630

Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.

Tried all of the recommendations in (maybe did it wrong as I am just getting into jest): https://github.com/popperjs/popper-core/issues/478 and https://github.com/popperjs/react-popper/issues/263

I recreated it in the codesandbox: https://codesandbox.io/s/tooltip-test-r8nqt?file=/src/Tooltip.spec.tsx

Any advice? tnx

skyboyer
  • 22,209
  • 7
  • 57
  • 64
Anna
  • 327
  • 1
  • 3
  • 9

1 Answers1

2

You are not providing a placement property in the defaultProps object of your tests.

Fez Vrasta
  • 14,110
  • 21
  • 98
  • 160