Skip to content

Instantly share code, notes, and snippets.

@jkelvie
Last active Sep 29, 2017
Embed
What would you like to do?
A Simple Test Using Virtual Alexa
test("Launches and plays", (done) => {
// Launch the skill
alexa.launch().then((payload) => {
// Test the correct text response comes back
expect(payload.response.outputSpeech.ssml).toContain("We show you images we got from Giphy");
// Once it launches, say Yes
return alexa.utter("yes");
}).then((payload) => {
expect(payload.response.outputSpeech.ssml).toContain("Take a look at this image");
// Cancel after the second interaction
return alexa.utter("cancel");
}).then((payload) => {
// Make sure the skill gracefully exists and ends the session
expect(payload.response.outputSpeech.ssml).toContain("Goodbye");
expect(payload.response.shouldEndSession).toBe(true);
done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment