Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Queries passed as options to render not being returned #15

Closed
@elyalvarado

Description

@elyalvarado

The documentation mentions that queries can be passed as an option to render to specify which queries to bind, or add custom bound queries

  • react-native or expo: react-native
  • native-testing-library version: 2.0.1
  • react-native version: 0.59.5
  • node version: 8.15.1
  • npm (or yarn) version: yarn 1.15.2

Relevant code or config:

The following test should pass

test('returns the queries passed as options bound to the container', () => {
  const _getQueryPassedAsOption = { bind: jest.fn(() => _getQueryPassedAsOption) }
  const queries = { getQueryPassedAsOption: _getQueryPassedAsOption };

  const { container, getQueryPassedAsOption } = render(<View />, { queries });

  expect(queries.getQueryPassedAsOption.bind).toHaveBeenCalledWith(null,container);
  expect(getQueryPassedAsOption).toEqual(_getQueryPassedAsOption);
});

Reproduction:

Add the test to any project with native-testing-library and it'll fail.

Problem description:

It should work as documented.

Suggested solution:

I'll submit a PR with the fix. Just give me a few minutes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions