Skip to main content

containItemsWhereEachItem

Callable

  • containItemsWhereEachItem<Actual>(expectation: Expectation<Actual>): Expectation<Actual[]>

  • Produces an expectation that is met when all the items of the actual array of Item[] meet the expectation.

    Ensuring that all the items in an array meet the expectation

    import { actorCalled } from '@serenity-js/core'
    import { Ensure, containItemsWhereEachItem, endsWith } from '@serenity-js/assertions'

    const items = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday' ]

    await actorCalled('Ester').attemptsTo(
    Ensure.that(items, containItemsWhereEachItem(endsWith('day'))),
    )

    Type parameters

    • Actual

    Parameters

    • expectation: Expectation<Actual>

    Returns Expectation<Actual[]>