UNPKG

@serenity-js/assertions

Version:

Serenity/JS universal assertion library supporting all types of functional tests, including both web and REST API scenarios

25 lines 823 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.matches = void 0; const core_1 = require("@serenity-js/core"); /** * Creates an [expectation](https://serenity-js.org/api/core/class/Expectation/) that is met when the actual `string` value * matches the `expected` regular expression. * * ## Ensuring that a given string matches a regular expression * * ```ts * import { actorCalled } from '@serenity-js/core' * import { Ensure, includes } from '@serenity-js/assertions' * * await actorCalled('Ester').attemptsTo( * Ensure.that('Hello World!', matches(/[Ww]orld/)), * ) * ``` * * @param expected * * @group Expectations */ exports.matches = core_1.Expectation.define('matches', 'match', (actual, expected) => expected.test(actual)); //# sourceMappingURL=matches.js.map