작성
·
1.4K
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.