Contents

expect

A callable that creates an intent expectation from value expectations for the intent’s parameters.

Declaration

var expect: IntentValueExpectationCallable<any ResolvableIntentValueExpectation, AppIntentExpectation> { get }

Discussion

Call expect with a labeled argument for each parameter you want to check. Each label names a parameter, and each argument is the value expectation for it. The order of the labels doesn’t matter. The expectation doesn’t check parameters you omit or pass nil for. Pass isNil to expect a parameter to be absent. For example:

let createEventIntentDefinition = definitions.intents["CreateEventIntent"]
let expectation = createEventIntentDefinition.expect(
    title: .contains("NASA")
)

The framework checks each parameter as the caller passed it, before any entity query runs. An entity parameter accepts an entity definition or an AppEntityIdentifierExpectation, but not an AppEntityExpectation.

The framework matches labels to parameter names when it evaluates the expectation, not when your code compiles, so a misspelled label reads as a missing parameter.