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

148
Vistas
What value to give void properties

I have this interface:

interface Props {
    close: () => void;
    disableButton: () => void;
    showPrompt: boolean;
    pol: string;
}

I'm trying to use it in a test. My problem is that I don't know what I should do with close and disableButton. They are just passed to that class so the state can be updated. What value do I give the variables for use in my shallow?

describe('<Reissue />', () => {
    it('calls reissue service', () => {
        const close = ???;
        const disableButton = ???;
        const showPrompt = true;
        const pol = '123456';

        const wrapper = shallow(<Reissue close={} disableButton={} showPrompt={showPrompt} pol={pol}/>);
    });    
});
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The void keyword in this context is used to indicate that the function returns no value, hence you can just use an empty closure () => {}.

If you are using jest, you can also use jest.fn(), which will behave the same but has the benefit of capturing information that will help you during your tests (e.g. how many times the function have been called)

https://jestjs.io/docs/mock-functions

about 4 years ago · Juan Pablo Isaza Denunciar

0

close and disableButton are functions so you should pass functions to them, even if empty empty ones -

const wrapper = shallow(<Reissue close={()=>()} disableButton={()=>()} showPrompt={showPrompt} pol={pol}/>);
about 4 years ago · Juan Pablo Isaza Denunciar
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