Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !11694

Docs/Fix running-tests.md accuracy

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/jayeclark/docs/update-test-docs into main 3 years ago
  • Overview 3
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: jayeclark

Signed-off-by: Jay Clark jay@jayeclark.dev

Fixes #11548

I came across issue #11548 and added a fix to make the docs match the current reality of src/App.test.js.

Compare
  • main (base)

and
  • latest version
    b0fef096
    3 commits, 2 years ago

2 files
+ 6
- 52695

    Preferences

    File browser
    Compare changes
docusau‎rus/docs‎
running-‎tests.md‎ +6 -4
package-‎lock.json‎ +0 -52691
docusaurus/docs/running-tests.md
+ 6
- 4
  • View file @ b0fef096


@@ -81,7 +81,7 @@ it('renders without crashing', () => {
});
```
This test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.js`.
This test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point.
When you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior.
@@ -112,16 +112,18 @@ import '@testing-library/jest-dom';
Here's an example of using `react-testing-library` and `jest-dom` for testing that the `<App />` component renders "Learn React".
```js
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
it('renders welcome message', () => {
test('renders learn react link', () => {
render(<App />);
expect(screen.getByText('Learn React')).toBeInTheDocument();
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
```
This test is included in `src/App.test.js` as an example to get you started. Altering the content of App.js that contains the target phrase will result in a failed test, so you'll need to alter this test to match the new content of your app.
Learn more about the utilities provided by `react-testing-library` to facilitate testing asynchronous interactions as well as selecting form elements from the [`react-testing-library` documentation](https://testing-library.com/react) and [examples](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples).
## Using Third Party Assertion Libraries
package-lock.json deleted 100644 → 0
+ 0
- 52691
  • View file @ 428ddb68

Changes are too large to be shown.

View file @ 428ddb68
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: kkroening/ffmpeg-python!88
Source branch: github/fork/jayeclark/docs/update-test-docs

Menu

Explore Projects Groups Snippets