Go to repository

Interface StringExpectation

This interface represents an expectation that is performed over a string.

Hierarchy (view full)

Properties

This attribute retrieves an expectancy whose result value is false in case the matcher fulfills, and true otherwise.

Methods

Answer the given expectation as an instance of IArrayExpectation. No check is performed on the input to see if it can actually be casted.

Type Parameters

  • E

Returns ArrayExpectation<E>

Answer the given expectation as an instance of INumberExpectation. No check is performed on the input to see if it can actually be casted.

Returns NumberExpectation

Answer the given expectation as an instance of IObjectExpectation. No check is performed on the input to see if it can actually be casted.

Type Parameters

  • E

Returns ObjectExpectation<E>

Answer the given expectation as an instance of IStringExpectation. No check is performed on the input to see if it can actually be casted.

Returns StringExpectation

Answers if the actual value is the same as expected, using strict compare. Do not use toBe with floating point numbers, use Expectations/Matchers.toBeCloseTo instead.

Parameters

  • value: string

Returns StringExpectation & FinishedExpectation

Answers if the actual value is defined (as in not equal to undefined)

Returns StringExpectation & FinishedExpectation

Answers if the actual value is a falsy value.

Returns StringExpectation & FinishedExpectation

Answers if the actual value is the same as expected, using a deep compare mechanism. Do not use toBeLike with floating point numbers, use Expectations/Matchers.toBeCloseTo instead.

Parameters

  • value: string

Returns StringExpectation & FinishedExpectation

Answers if the actual value is null (strict null, not undefined).

Returns StringExpectation & FinishedExpectation

Answers if the actual value is a truthy value.

Returns StringExpectation & FinishedExpectation

Answers if the actual value is undefined.

Returns StringExpectation & FinishedExpectation

Answer if the actual value ends with the expected string.

Parameters

  • end: string

Returns StringExpectation & FinishedExpectation

Answer if the actual element has the given shape, as defined by the shapeOf submodule.

Parameters

  • shape: Shape

Returns StringExpectation & FinishedExpectation

Answer if the actual value has expected as a substring.

Parameters

  • substring: string

Returns StringExpectation & FinishedExpectation

Answers if the actual value has a type matching the expected type, checked by using the typeof operator.

Parameters

  • value: string

Returns StringExpectation & FinishedExpectation

`toHaveType('hello', 'string')` returns `true`.

Answer if the actual value matches the given regexp.

Parameters

Returns StringExpectation & FinishedExpectation

Answer if the actual value starts with the expected string.

Parameters

  • start: string

Returns StringExpectation & FinishedExpectation