StringSubject

certainty~ StringSubject

new StringSubject(failureStrategy, value)

Subclass of Subject which provides assertions methods for string types.

Parameters:
Name Type Description
failureStrategy FailureStrategy

The failure strategy to use when an assertion fails.

value object

The value being checked.

Source:

Extends

  • Subject

Methods

doesNotInclude(expected) → {ObjectSubject}

Ensure that the string being tested does not contain the expected substring.

Parameters:
Name Type Description
expected string

The substring which this string is expected not to contain.

Source:
Returns:

this for chaining.

Type
ObjectSubject

endsWith(expected) → {ObjectSubject}

Ensure that the string being tested ends with the expected substring.

Parameters:
Name Type Description
expected string

The substring which this string is expected end with.

Source:
Returns:

this for chaining.

Type
ObjectSubject

includes(expected) → {ObjectSubject}

Ensure that the string being tested contains the expected substring.

Parameters:
Name Type Description
expected string

The substring which this string is expected to contain.

Source:
Returns:

this for chaining.

Type
ObjectSubject

isEmpty() → {ObjectSubject}

Ensure that the string being tested is the empty string.

Source:
Returns:

this for chaining.

Type
ObjectSubject

isNotEmpty() → {ObjectSubject}

Ensure that the object being tested is not the empty string.

Source:
Returns:

this for chaining.

Type
ObjectSubject

matches(regex) → {ObjectSubject}

Ensure that the string being tested matches the given regular expression.

Parameters:
Name Type Description
regex string

The regular expression.

Source:
Returns:

this for chaining.

Type
ObjectSubject

startsWith(expected) → {ObjectSubject}

Ensure that the string being tested starts with the expected substring.

Parameters:
Name Type Description
expected string

The substring which this string is expected start with.

Source:
Returns:

this for chaining.

Type
ObjectSubject