Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

418
Visualizações
Method props is meant to be run on 1 node, 0 found instead (Jest, ReactJS)

Stuck what the best way is to do a unit testing on a Hook that checks if there is a matching character between input text and text of api. Only the NOT matching letter will be bold and the matching letter will stay normal. How do I test element that are only showing when typing more than 2 characters. This is basically a dropdown menu.

  return (
    <SearchResultComponent>
      {(loadingData && currentInputLength) ?
        <SearchResultBlockShow>
          {getResult.map((item: SearchTerm, index: number) => (
            <SearchResultBlock key={index} >
              <MakeBold currentResult={item.searchterm} keyword={currentInput} />
              <SearchResultSpan>{"(" + item.nrResults + ")"}</SearchResultSpan>
            </SearchResultBlock>
          ))} </SearchResultBlockShow> : <SearchNoResult>No Result</SearchNoResult>}

    </SearchResultComponent>
  )

][1]]2

import { mount, shallow } from "enzyme";
import { Provider } from "react-redux";
import { screen } from "@testing-library/dom";
import { render } from "@testing-library/react";
import '@testing-library/jest-dom';
import { store } from "../Store";
import { MakeBold } from "./matchCharacter";

it("SearchResult Component test props", () => {
    const wrap = shallow(
        <Provider store={store}>
            <MakeBold currentResult={"trui"} keyword={"trui"} />
        </Provider>
    );

    expect(
        wrap.find({ "data-testid": "match-character-test" }).
            filter((x: any) => x.props('dangerouslySetInnerHTML')).
            prop('dangerouslySetInnerHTML').
            __html
    ).toBe('<span>trui<span>');

});

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda