Skip to content

docs(prefer-explicit-assert): remove references to old rule #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions docs/rules/prefer-explicit-assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ elements in their tests rather than just use `getBy*` queries and expect
it doesn't throw an error so it's easier to understand what's the
expected behavior within the test.

> ⚠️ Please note that this rule is recommended to be used together with
> [prefer-expect-query-by](docs/rules/prefer-expect-query-by.md), so the
> combination of these two rules will force users to do 2 actual
> changes: wrap `getBy*` with `expect` assertion and then use `queryBy*`
> instead of `getBy*` for asserting.

Examples of **incorrect** code for this rule:

```js
Expand All @@ -41,9 +35,6 @@ expect(getByText('foo')).toBeDefined();
const utils = render(<Component />);
expect(utils.getByText('foo')).toBeDefined();

// ⚠️ `getBy*` should be replaced by `queryBy*` when combined with `prefer-expect-query-by` rule
expect(queryByText('foo')).toBeDefined();

// even more explicit if you use `@testing-library/jest-dom` matcher
// for checking the element is present in the document
expect(queryByText('foo')).toBeInTheDocument();
Expand Down Expand Up @@ -74,10 +65,6 @@ This rule accepts a single options argument:
If you prefer to use `getBy*` queries implicitly as an assert-like
method itself, then this rule is not recommended.

## Related Rules

- [prefer-expect-query-by](prefer-expect-query-by.md)

## Further Reading

- [getBy query](https://testing-library.com/docs/dom-testing-library/api-queries#getby)