new SkillTester(index, configopt)
SkillTester is a simple testing framework for a skill. It will envoke a skill
with a mock request and return the results
Parameters:
Name |
Type |
Attributes |
Description |
index |
String
|
|
Location of the index.js for the app |
config |
Object
|
<optional>
|
Additional configuration options (not yet used) |
- Source:
Example
// set where index.js is located
var skillTester = new SkillTester('../../index.js');
// test the 'hello' intent
skillTester.test('hello');
Methods
buildRequest(intent, options) → {JSON}
Builds a valid request JSON obejct for a skill
If no options are set the defauls (outlined in the
SkillTester#test function) are used
Parameters:
Name |
Type |
Description |
intent |
String
|
The name of the intent to execute |
options |
Object
|
The values of the request object that should override the default values |
- Source:
- See:
-
Returns:
The JSON representing the request
-
Type
-
JSON
A default callback that takes the JSON result, stringifies it, and sends it to the console
- Source:
Returns:
A valid callback for handling skill results
-
Type
-
SkillTester~callback
test(intent, requestOptions, callback)
Tests the specified intent for the skill.
If not requestOptions are specified it will use the default settings in
SkillTester~request
Parameters:
Name |
Type |
Description |
intent |
String
|
The name of the intent to to invoke in the skill |
requestOptions |
Map
|
A map of the key:values in the request that should be used. These will override the default values |
callback |
SkillTester~callback
|
The callback to pass the results of the skill execution to |
- Source:
- See:
-
Type Definitions
callback
Type:
-
Object.<string, function()>
Properties:
Name |
Type |
Description |
success |
function
|
Properties
Name |
Type |
Description |
result |
JSON
|
The results of the successful skill execution |
|
fail |
function
|
Properties
Name |
Type |
Description |
error |
JSON
|
The result of an unsuccessful skill execution |
|
- Source:
request
Type:
Properties:
Name |
Type |
Description |
request |
Object
|
Information on the request to the skill
Properties
Name |
Type |
Description |
intent |
Object
|
Properties
Name |
Type |
Description |
name |
String
|
The name of the intent |
|
requestId |
string
|
The unique Id of the request. Defaults to 'fakeRequestId' |
type |
string
|
The type of the request. Defaults to 'IntentRequest' |
|
session |
Object
|
Information on the session for the skill
Properties
Name |
Type |
Description |
application |
string
|
Properties
Name |
Type |
Description |
id |
string
|
The Id of the application (as checked in the skill). Defauls to "fakeApplicationId" |
|
sessionId |
string
|
The Id of the session. Defaults to 'fakeSessionId' |
user |
Object
|
Properties
Name |
Type |
Description |
userId |
string
|
The Id of the user. Defaults to 'fakeUserId' |
|
new |
boolean
|
Is this a new session. Defaults to true |
|
- Source: