Go to repository

Function expect

Create a new expectation over an element. The type of the returned expectation depends on the type of the element passed, and thus, different matchers may be executed over the expectation. The generic matchers can be called over any expectation for any element, this include:

If the given element is a number, then an NumberExpectation is returned, and so the following additional matchers are added to the previous list:

If a string is used instead, the list is expanded with the following matchers:

For the case of arrays, additional to the general ones, the following matchers are provided, that allow to test things over the elements of the array.

For object, the focus of the matcher is put on the instance type (class it belongs to) and the properties it contains (attribute keys), extending so with:

Parameters

  • Optional
    element: boolean

    The element that is going to be queried by the created expectation.

Returns BooleanExpectation

Parameters

  • Optional
    element: number

Returns NumberExpectation

Parameters

  • Optional
    element: string

Returns StringExpectation

Type Parameters

  • T

Parameters

  • Optional
    element: T[]

Returns ArrayExpectation<T>

Type Parameters

  • T

Parameters

  • Optional
    element: T

Returns ObjectExpectation<T>