Skip to content
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 opened this issue May 5, 2019 · 1 comment · Fixed by #16
Closed

Queries passed as options to render not being returned #15

elyalvarado opened this issue May 5, 2019 · 1 comment · Fixed by #16
Labels

Comments

@elyalvarado
Copy link
Contributor

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

elyalvarado added a commit to elyalvarado/native-testing-library that referenced this issue May 5, 2019
…ions

The documentation mentions that queries can be passed as an option
to render to specify which queries to bind, or add custom bound
queries. This commit fixes this behaviour and adds a regression test.
@bcarroll22
Copy link
Collaborator

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants