Skip to main content

matches

Callable

  • matches(...answerableArguments: [expected: Answerable<RegExp>]): Expectation<string>

  • Creates an expectation that is met when the actual string value matches the expected regular expression.

    Ensuring that a given string matches a regular expression

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

    await actorCalled('Ester').attemptsTo(
    Ensure.that('Hello World!', matches(/[Ww]orld/)),
    )

    Parameters

    • rest...answerableArguments: [expected: Answerable<RegExp>]

    Returns Expectation<string>