Ensure <Actual>
Hierarchy
- Interaction
- Ensure
Index
Methods
staticthat
Creates an interaction to
Ensure
, which verifies if the resolved value of the provided Answerable meets the specified Expectation. If not, it immediately throws an AssertionError.Type parameters
- Actual_Type
Parameters
actual: Answerable<Actual_Type>
An Answerable describing the actual state of the system.
expectation: Expectation<Actual_Type>
An Expectation you expect the
actual
value to meet
Returns Ensure<Actual_Type>
staticeventually
Creates an interaction to EnsureEventually, which verifies if the resolved value of the provided Answerable meets the specified Expectation within the expected timeframe.
If the expectation is not met by the time the timeout expires, the interaction throws an AssertionError.
EnsureEventually
ignores retries the evaluation if resolving theactual
results in an OptionalNotPresentError, but rethrows any other errors.Type parameters
- Actual_Type
Parameters
actual: Answerable<Actual_Type>
An Answerable describing the actual state of the system.
expectation: Expectation<Actual_Type>
An Expectation you expect the
actual
value to meet
Returns EnsureEventually<Actual_Type>
performAs
Parameters
actor: UsesAbilities & AnswersQuestions & CollectsArtifacts
Returns Promise<void>
otherwiseFailWith
Overrides the default AssertionError thrown when the actual value does not meet the expectation.
Parameters
typeOfRuntimeError: new (message: string, cause?: Error) => RuntimeError
A constructor function producing a subtype of RuntimeError to throw, e.g. TestCompromisedError
optionalmessage: string
The message explaining the failure
Returns Interaction
instantiationLocation
Returns the location where this Activity was instantiated.
Returns FileSystemLocation
toString
Generates a human-friendly description to be used when reporting this Activity.
Note: When this activity is reported, token
#actor
in the description will be replaced with the name of the actor performing this Activity.For example,
#actor clicks on a button
becomesWendy clicks on a button
.Returns string
The interaction to
Ensure
verifies if the resolved value of the provided Answerable meets the specified Expectation. If not, it throws an AssertionError.Use
Ensure
to verify the state of the system under test.Basic usage with static values
Composing expectations with
and
Overriding the type of Error thrown upon assertion failure