diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index b31c55a510..f387b86002 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -26,6 +26,7 @@ // Tony Hallett // Jason Yu // Devansh Jethmalani +// Pawel Fajfer // 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. diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 854383651b..269eea3615 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -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');