Home > Enterprise >  How to write test case for EmptyComponent in Jest
How to write test case for EmptyComponent in Jest

Time:01-21

Below is the code in my component

export default () => null;

How to write test case for this to get coverage for the function

CodePudding user response:

It is just a function you can do this:

import Empty from './Empty'

test('renders null', () => {
  const res = Empty()
  expect(res).toBeNull()
})

  • Related