expect.stringContaining() matches a string that contains the expected substring. Use this method inside expect(value).toEqual(expected) to perform pattern matching.
expect.stringContaining()
Usage
expect('Hello world!').toEqual(expect.stringContaining('Hello')); Copy
expect('Hello world!').toEqual(expect.stringContaining('Hello'));
Expected substring.
expect.stringContaining()matches a string that contains the expected substring. Use this method inside expect(value).toEqual(expected) to perform pattern matching.Usage