Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
How to trigger functions with wrapped mounted components JEST

So I am trying to add unit tests to my FUNCTIONAL components.

I am using react-redux + redux-saga in my application.

Component That I want to test:

enter image description here

This is the test that I have it right now

    const store = mockStore(state);

    wrapper = mount(
       <Provider store={ store }>
          <ItemTab />
       </Provider>
    );

In my component ItemTab.js I have this function

    function test() {
       console.log('testing')
    }

And in my ItemTab.test.js I am calling this test

describe('ItemTab', () => {
    it('first test', () => {
        wrapper.test()
    });
})

And If I do that I have this error wrapper.test is not a function

Notes:

  1. I tried using the dive() property but it doesn't seem to be working from me.
  2. I can't use shallow instead but the wrapper.instance() is always giving me null

So my questions are:

  1. How can I test a functional component with redux + redux-saga?
  2. How can I trigger a function inside a component without trying to find a button so I can trigger a simulation?
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda