source: frontend/node_modules/eslint-plugin-jest/docs/rules/prefer-strict-equal.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 710 bytes
Line 
1# Suggest using `toStrictEqual()` (`prefer-strict-equal`)
2
3`toStrictEqual` not only checks that two objects contain the same data but also
4that they have the same structure. It is common to expect objects to not only
5have identical values but also to have identical keys. A stricter equality will
6catch cases where two objects do not have identical keys.
7
8## Rule details
9
10This rule triggers a warning if `toEqual()` is used to assert equality.
11
12### Default configuration
13
14The following pattern is considered warning:
15
16```js
17expect({ a: 'a', b: undefined }).toEqual({ a: 'a' }); // true
18```
19
20The following pattern is not warning:
21
22```js
23expect({ a: 'a', b: undefined }).toStrictEqual({ a: 'a' }); // false
24```
Note: See TracBrowser for help on using the repository browser.