Skip to main content

externalcontain

Callable


  • Produces an expectation that is met when the actual array of Item[] contains at least one Item that is equal to the resolved value of expected.

    Note that the equality check performs comparison by value using TinyTypes equal.

    Ensuring that the array contains the given item

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

    const items = [ { name: 'apples' }, { name: 'bananas' } ]

    await actorCalled('Ester').attemptsTo(
    Ensure.that(items, contain({ name: 'bananas' })),
    )

    Type parameters

    • Item

    Parameters

    • externalrest...answerableArguments: [expected: Answerable<Item>]

    Returns Expectation<Item[]>