pub struct Expectations {Show 14 fields
pub outcome: OutcomeExpectation,
pub acts: Option<Vec<ActExpectation>>,
pub target_resolution: Vec<TargetExpectation>,
pub commands: Option<Vec<String>>,
pub events: Option<Vec<String>>,
pub case_revision: Vec<RevisionExpectation>,
pub interaction_status: Vec<InteractionStatusExpectation>,
pub case_state: Vec<StateExpectation>,
pub workflow_state: Vec<WorkflowStateExpectation>,
pub case_count: Vec<CaseCountExpectation>,
pub blocks: Option<Vec<BlockKind>>,
pub turn_phase: Option<TurnPhase>,
pub forbid: ForbiddenEffects,
pub understanding: Option<UnderstandingExpectation>,
}Expand description
What must be true after the turn, checked without a model (spec §27.6).
Every field is optional and every one of them means the same thing when
absent: this item does not assert on it. A field that is present is an
exact claim — commands = [] asserts that the turn compiled no command at
all, which is a different and much stronger statement than leaving the key
out.
Fields§
§outcome: OutcomeExpectationWhether the turn must complete at all. Defaults to
OutcomeExpectation::Succeeds, so a crashed turn fails an item even
when every other expectation is trivially satisfied by the wreckage.
acts: Option<Vec<ActExpectation>>The acts the message was understood to ask for, in order.
target_resolution: Vec<TargetExpectation>How each act’s target resolved.
commands: Option<Vec<String>>The command types journaled this turn, in admission order.
events: Option<Vec<String>>The event types committed this turn, in append order.
case_revision: Vec<RevisionExpectation>The revision each case ends the turn at.
interaction_status: Vec<InteractionStatusExpectation>The status of the cards on a case.
case_state: Vec<StateExpectation>What a case’s state says after the turn, field by field.
The two questions it answers are not the same one. equals asks what a
value ended up being, which is how a scenario about a user changing their
mind, Porto and then Lisbon, can say which one survived; the events
alone cannot, because both stories commit the same event. unchanged
asks that a value did not move at all, which is what a turn whose correct
answer writes nothing needs.
workflow_state: Vec<WorkflowStateExpectation>What some case of a workflow holds at the end, seeded or created by the conversation, for a case whose identifier no file can know.
case_count: Vec<CaseCountExpectation>How many cases of a workflow exist at the end, seeded and created.
blocks: Option<Vec<BlockKind>>The kinds of response block, in order.
turn_phase: Option<TurnPhase>The phase the turn finished in.
forbid: ForbiddenEffectsEffects that must not appear.
understanding: Option<UnderstandingExpectation>What each understanding task must make of the message.
Implementations§
Source§impl Expectations
impl Expectations
Sourcepub fn validate(&self) -> Result<(), CorpusError>
pub fn validate(&self) -> Result<(), CorpusError>
Checks the expectations do not contradict each other.
§Errors
CorpusError::Invalid when an act names an operation its kind cannot
carry, when a resolution names a case it cannot have, or when the same
command or event is both required and forbidden.