/
helloworld-tests.js
52 lines (45 loc) · 1.49 KB
/
helloworld-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Mocha tests for the Alexa skill "Hello World" example (https://github.com/alexa/skill-sample-nodejs-hello-world).
Using the Alexa Skill Test Framework (https://github.com/BrianMacIntosh/alexa-skill-test-framework).
Run with 'mocha examples/skill-sample-nodejs-hello-world/helloworld-tests.js'.
*/
// include the testing framework
//const alexaTest = require('alexa-skill-test-framework');
const alexaTest = require('../../index');
// initialize the testing framework
alexaTest.initialize(
require('./helloworld.js'),
"amzn1.ask.skill.00000000-0000-0000-0000-000000000000",
"amzn1.ask.account.VOID");
describe("Hello World Skill", function () {
// tests the behavior of the skill's LaunchRequest
describe("LaunchRequest", function () {
alexaTest.test([
{
request: alexaTest.getLaunchRequest(),
says: "Hello World!", repromptsNothing: true, shouldEndSession: true
}
]);
});
// tests the behavior of the skill's HelloWorldIntent
describe("HelloWorldIntent", function () {
alexaTest.test([
{
request: alexaTest.getIntentRequest("HelloWorldIntent"),
says: "Hello World!", repromptsNothing: true, shouldEndSession: true,
hasAttributes: {
foo: 'bar'
}
}
]);
});
// tests the behavior of the skill's HelloWorldIntent with like operator
describe("HelloWorldIntent like", function () {
alexaTest.test([
{
request: alexaTest.getIntentRequest("HelloWorldIntent"),
saysLike: "World", repromptsNothing: true, shouldEndSession: true
}
]);
});
});