Core Modules@serenity-js/assertionsExpectationsisBeforeexternalisBefore CallableisBefore(...answerableArguments: [expected: Answerable<Date | Timestamp>]): Expectation<Date | Timestamp>Creates an expectation that is met when the actual value of type Date is before the expected Date. Ensuring that a given date is after the expected dateimport { actorCalled } from '@serenity-js/core'import { Ensure, isBefore } from '@serenity-js/assertions'await actorCalled('Ester').attemptsTo( Ensure.that(new Date('1995-01-01'), isBefore(new Date('2022-01-01'))),) Ensuring that a given date is within the expected date rangeimport { actorCalled, Expectation, d } from '@serenity-js/core'import { Ensure, and, isAfter, isBefore } from '@serenity-js/assertions'const isWithinDateRange = (lowerBound: Answerable<Date>, upperBound: Answerable<Date>) => Expectation.to(d`have value that is between ${ lowerBound } and ${ upperBound }`) .soThatActual( and(isAfter(lowerBound), isBefore(upperBound)) ),await actorCalled('Ester').attemptsTo( Ensure.that( new Date('2022-01-01'), isWithinDateRange(new Date('1995-01-01'), new Date('2025-01-01')) ),)Parametersexternalrest...answerableArguments: [expected: Answerable<Date | Timestamp>]Returns Expectation<Date | Timestamp>
Creates an expectation that is met when the actual value of type
Date
is before the expectedDate
.Ensuring that a given date is after the expected date
Ensuring that a given date is within the expected date range