PrimitiveExpectation
A value expectation that checks whether a value is present or whether its string content matches.
Declaration
struct PrimitiveExpectationOverview
Use a primitive expectation to require that an intent parameter, app entity property, or intent result has a value or has no value, or to check the content of a string value. String comparisons are exact and case-sensitive. A string expectation on a non-string value isn’t satisfied.
You don’t create a primitive expectation directly. Use isNil, notNil, contains(_:), contains(regex:), or equals(_:) instead. Passing nil as an expect argument is the same as leaving out its label: the expectation doesn’t check the value.
The following example expects an event with a title that contains “NASA”, a location, and no end date:
let createEventIntentDefinition = definitions.intents["CreateEventIntent"]
let expectation = createEventIntentDefinition.expect(
title: .contains("NASA"),
location: .notNil,
endDate: .isNil
)