import ReactIs from 'react-is'

declare global {
  namespace jest {
    interface Matchers<R> {
      toBeComponent(): R,
    }
  }
}

export const toBeComponent = (received: any) => ({
  message: () => `expected ${received} to be a component`,
  pass: ReactIs.isValidElementType(received),
})
