Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function giveTip(callback) {
callback({}, buildSpeechletResponse("Tip", `Your tip is: "${tip}"! Good luck with the challenge!`, "", true));
}

function onIntent(intentRequest, session, callback) {
console.log(`onIntent requestId=${intentRequest.requestId}, sessionId=${session.sessionId}`);
exports.onIntent = function(intentRequest, session, callback) {
console.log(`exports.onIntent requestId=${intentRequest.requestId}, sessionId=${session.sessionId}`);

const intentName = intentRequest.intent.name;

Expand Down Expand Up @@ -172,7 +172,7 @@ exports.handler = (event, context, callback) => {
callback(null, buildResponse(sessionAttributes, speechletResponse));
});
} else if (event.request.type === 'IntentRequest') {
onIntent(event.request,
exports.onIntent(event.request,
event.session,
(sessionAttributes, speechletResponse) => {
callback(null, buildResponse(sessionAttributes, speechletResponse));
Expand Down
194 changes: 194 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"test": "return true;"
{
"scripts": {
"test": "mocha"
},
"devDependencies": {
"mocha": "^5.2.0"
}
}
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var assert = require("assert");

var mainthing = require("..")

describe("Date Thing", function() {
describe("Date responses", function() {
it("should mention the 6th of november when asked when assess started", function() {
mainthing.onIntent({"intent":{"name":"assess_start_date"}}, {}, function(a, b){
assert(b.outputSpeech.text.includes("6th of November"));
})
})
})
})