What's the use case to use stringContaining instead of just using toContain for substring matching with Jest?
it("tests with stringContaining", () => {
expect("testerama").toEqual(expect.stringContaining("test"))
})
it("tests with toContain", () => {
expect("testerama").toContain("test")
})
As far as I can see the behaviour is similar apart from that if the string is null or undefined the stringContaining error message is a bit clearer.
Expected: StringContaining "test"
Received: null
as opposed to
Matcher error: received value must not be null nor undefined
Received has value: null
It hardly seems worth it for the less terse code. Am I missing something?