Skip to content

Unused variable in example code in docs #115

Closed
@apaatsio

Description

@apaatsio

Relevant code or config:

In the documentation at https://chrisnoring.gitbooks.io/react/content/testing/react-testing-library.html there is this example.

it('load data', async() => {
    const {getByText, getByTestId, getByPlaceholderText, container} = render(<Select />);

    Simulate.click(getByText('Load'));
    await wait(() => getByTestId('data'))
    const data = getByTestId('data')
    const elem = getByTestId('item');
    expect(elem).toHaveTextContent('test');
  })

Problem description:

The variable data is never used, so the line const data = getByTestId('data') is unnecessary since it doesn't have any effect on the outcome of the test.

Suggested solution:

Remove the line const data = getByTestId('data')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions