Assert string includes
Assert that an value is included in a string.
Most likely you want to use this package as development dependency.
npm install @jerone/assert-includes --save-dev
Or with Yarn:
yarn add @jerone/assert-includes --dev
import assertIncludes from '@jerone/assert-includes';
test("value contains string", () => {
assertIncludes("abc", "a");
});
If the test fails, it will throw an AssertionError
,
which can be picked up by your testing library.
For example with Jest, it will produce the following log:
Returns true
when valid or throws AssertionError
when invalid.
Type: string
Actual value expected to contain the included text.
Type: string
The text that is expected to be part of the value
.