[@types/jest] Improve toContain matcher description. (#42965)

This commit is contained in:
Pawel 2020-03-07 02:49:53 +01:00 committed by GitHub
parent 3c7535ff99
commit 86d96fc87e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@
// Tony Hallett <https://github.com/tonyhallett>
// Jason Yu <https://github.com/ycmjason>
// Devansh Jethmalani <https://github.com/devanshj>
// Pawel Fajfer <https://github.com/pawfa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
@ -805,6 +806,7 @@ declare namespace jest {
/**
* Used when you want to check that an item is in a list.
* For testing the items in the list, this uses `===`, a strict equality check.
* It can also check whether a string is a substring of another string.
*
* Optionally, you can provide a type for the expected value via a generic.
* This is particuarly useful for ensuring expected objects have the right structure.

View File

@ -869,6 +869,7 @@ describe('', () => {
expect([]).toContain({});
expect(['abc']).toContain('abc');
expect(['abc']).toContain('def');
expect('abc').toContain('bc');
expect([]).toContainEqual({});
expect(['abc']).toContainEqual('def');