Skip to main content

containAtLeastOneItemThat

Callable

  • containAtLeastOneItemThat<Item>(expectation: Expectation<Item>): Expectation<Item[]>

  • Produces an expectation that is met when the actual array of Item[] contains at least one Item for which the expectation is met.

    Ensuring that at least one item in an array meets the expectation

    import { actorCalled } from '@serenity-js/core'
    import { Ensure, containAtLeastOneItemThat, isGreaterThan } from '@serenity-js/assertions'

    const items = [ 10, 15, 20 ]

    await actorCalled('Ester').attemptsTo(
    Ensure.that(items, containAtLeastOneItemThat(isGreaterThan(18))),
    )

    Type parameters

    • Item

    Parameters

    • expectation: Expectation<Item>

    Returns Expectation<Item[]>