Assert specific strings inside outputSpeech and reprompt
Closed this issue · 3 comments
omenocal commented
It would be really cool to assert certain words or phrases inside the output and reprompt speech instead of matching the whole string.
armonge commented
i think you can do that using the saysCallback
BrianMacIntosh commented
Yep, you can do that. I could see making it part of the API to make it less verbose, though - or providing a method to generate that callback for you.
armonge commented
i've been doing this lately
const expect = require('chai').expect;
function assertReply(expectedReply) {
return (context, speech) => {
expect(speech).to.equal(`<speak>${expectedReply}</speak>`);
};
}
{ request: alexaTest.getIntentRequest('AMAZON.YesIntent'), shouldEndSession: false, saysCallback: assertReply('Great!') },