Skip to content

Bug: react-test-renderer: promise returned from findByProps query must be handled #23093

Closed
@josias-r

Description

@josias-r

React (and react-test-renderer) version: 17.0.2
Eslint version: 8.6.0

Steps To Reproduce

  1. create a ReactTestInstance using create from react-test-renderer
  2. Try to run access findByProps of the root of ReactTestInstance
  3. Eslint(testing-library/await-async-query) will show an error

code example:

// simulate nav toggle click event
create(<Nav onToggle={mockFunction} items={[]}></Nav>)
  .root.findByProps({
    className: "app__nav-toggler",
  })
  .props.onClick();

The current behavior

Eslint(testing-library/await-async-query) will show an error:

Screenshot 2022-01-11 at 11 57 52

Screenshot 2022-01-11 at 12 00 31

The expected behavior

Since the return type of findByProps is not actually a promise, the error should not appear. findByProps appears to be synchronous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions