inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

따라하며 배우는 도커와 CI환경 [2023.11 업데이트]

리액트 앱 테스트 하기

테스트 실행 시 fail이 발생하는데 왜 그런걸까요??ㅜㅜ

1489

형욱박

작성한 질문수 31

0

안녕하세요. 테스트 진행 중에 fail이 발생해서 왜 그런지 잘 모르겠습니다. 

아래는 fail 로그예요

 FAIL  src/App.test.js

  ✕ renders learn react link (42ms)

  ● renders learn react link

    Unable to find an element with the text: /learn react/i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

    <body>

      <div>

        <div

          class="App"

        >

          <header

            class="App-header"

          >

            <img

              alt="logo"

              class="App-logo"

              src="logo.svg"

            />

            <p>

              Edit 

              <code>

                src/App.js

              </code>

               and save to reload.

            </p>

            <a

              class="App-link"

              href="https://reactjs.org"

              rel="noopener noreferrer"

              target="_blank"

            >

              반갑습니다.

            </a>

          </header>

        </div>

      </div>

    </body>

       5 | test('renders learn react link', () => {

       6 |   const { getByText } = render(<App />);

    >  7 |   const linkElement = getByText(/learn react/i);

         |                       ^

       8 |   expect(linkElement).toBeInTheDocument();

       9 | });

      10 | 

      at Object.getElementError (node_modules/@testing-library/dom/dist/config.js:34:12)

      at node_modules/@testing-library/dom/dist/query-helpers.js:71:38

      at getByText (node_modules/@testing-library/dom/dist/query-helpers.js:54:17)

      at Object.<anonymous> (src/App.test.js:7:23)

Test Suites: 1 failed, 1 total

Tests:       1 failed, 1 total

Snapshots:   0 total

Time:        1.958s

Ran all test suites.

docker github aws 데이터 엔지니어링 cicd travis-ci

답변 1

0

John Ahn

왜냐면   learn react 라는 글짜가  렌더링 하는 jsx 안에 있어야 하는 데 없어서 그런겁니다 .  
저 테스트 부분을 없애고 진행해주세요 ^^ 

Docker Containers간 통신 할 때 나타나는 에러 강의 질문

0

78

1

WINDOW + Vite를 사용하여 소스 코드 변경이 반영되지 않는 현상

0

77

1

도커 컨테이너 끼리 SSL 통신 시 문제가 생깁니다..

0

213

1

도표 강의 자료 사용이 불가합니다. (권한 문제)

0

133

1

Docker compose 관련 공유

0

138

1

트레비스가 유료화가 되어 테스트가 어려워 챕터8에서 고민중입니다.

0

77

1

강사님 혹시 vscode 어떤 테마 쓰시나요..?

0

284

1

The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist.

0

105

1

travis ci가 이제 유료화가 된 것 같습니다;;;

0

208

2

docker-compose up 에러 공유 드립니다

0

290

1

Elastic Beanstalk에서 도메인 클릭시 react 이미지가 안나오고 다른 화면이 나오는데

0

168

1

도커 빌드 시간이 너무 오래걸려요..

0

1051

2

docker-compose down 이후에도 containers에 redis가 남아 있는 이유

0

163

1

도커 볼륨이 작동이 안되는것 같아서 질문드립니다!

0

210

2

docker-compose 가 Docker Desktop 에서 빠진건가요? command not found 라고 뜨네요

0

276

1

Error response from daemon: The system cannot find the file specified.

0

218

1

draw.io 오류

0

642

1

Docker Volume 오류(reference, lowercase)

0

563

1

[섹션3 - 내가 만든 이미지 기억하기 쉬운 이름 주기] 네이밍/태그 에러

0

224

1

axios오류 문의드립니다!

0

332

1

node.js version

0

483

1

안녕하세요 마지막 강의 질문 있습니다.

0

431

1

Deploy를 계속 실패합니다.

3

1378

4

TravisCI에서 계속 에러가 납니다....

0

354

1