Core Modules@serenity-js/assertionsExpectationscontainexternalcontain Callablecontain<Item>(...answerableArguments: [expected: Answerable<Item>]): Expectation<Item[]>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 itemimport { 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 parametersItemParametersexternalrest...answerableArguments: [expected: Answerable<Item>]Returns Expectation<Item[]>
Produces an expectation that is met when the actual array of
Item[]
contains at least oneItem
that is equal to the resolved value ofexpected
.Note that the equality check performs comparison by value using TinyTypes
equal
.Ensuring that the array contains the given item