@jerone/assert-includes
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

assert-includes

Assert string includes

Assert that an value is included in a string.

Install

Most likely you want to use this package as development dependency.

npm install @jerone/assert-includes --save-dev

Or with Yarn:

yarn install @jerone/assert-includes --dev

Usage

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:

Jest log

API

assertIncludes(value, includes)

Returns true if valid or throws AssertionError if invalid.

value

Type: string

Value expected to contain the included text.

includes

Type: string

The text that is part of the value.

Readme

Keywords

Package Sidebar

Install

npm i @jerone/assert-includes

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

5.05 kB

Total Files

6

Last publish

Collaborators

  • jerone