Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/clear dialogflow interface #184

Merged
merged 3 commits into from
Apr 2, 2018
Merged
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
27 changes: 0 additions & 27 deletions action.json

This file was deleted.

1 change: 0 additions & 1 deletion functions/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ rules:
comma-dangle: 0
mocha/no-exclusive-tests: error
no-unused-expressions: 0
no-extend-native: ["error", { "exceptions": ["Array"] }]
4 changes: 2 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ logAppStart(actionsMap);
setup();

/**
* Action Endpoint
* Action of Google Endpoint
*
* @type {HttpsFunction}
*/
exports.playMedia = functions.https.onRequest(bst.Logless.capture(functions.config().bespoken.key, function (req, res) {
exports.assistant = functions.https.onRequest(bst.Logless.capture(functions.config().bespoken.key, function (req, res) {
const app = new DialogflowApp({request: req, response: res});

logRequest(app, req);
Expand Down
4 changes: 2 additions & 2 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"scripts": {
"lint": "eslint ./",
"mocha": "mocha --opts ./tests/mocha.opts",
"start": "firebase serve --only functions:playMedia",
"deploy": "firebase deploy --only functions:playMedia",
"start": "firebase serve --only functions:assistant",
"deploy": "firebase deploy --only functions:assistant",
"test": "npm run lint && npm run mocha"
},
"dependencies": {
Expand Down
3 changes: 0 additions & 3 deletions functions/src/array.js

This file was deleted.

8 changes: 4 additions & 4 deletions functions/tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {wait} = require('./_utils/wait');

let index, configStub, adminInitStub, functions, admin;

describe('playMedia', () => {
describe('assistant', () => {
let res;

before(function () {
Expand All @@ -24,11 +24,11 @@ describe('playMedia', () => {
});

it('should be defined', () => {
expect(index.playMedia).to.be.ok;
expect(index.assistant).to.be.ok;
});

it('should store last used action', () => {
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action: 'welcome',
lastSeen: null,
}), res);
Expand All @@ -39,7 +39,7 @@ describe('playMedia', () => {
const action = 'on-definitely-uncovered-action';
let warning = sinon.spy();
index.__set__('warning', warning);
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action,
lastSeen: null,
}), res);
Expand Down
8 changes: 4 additions & 4 deletions functions/tests/integration/input-unknown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('integration', () => {
describe('input-unknown', () => {
it('should 1st time', () => {
const res = new MockResponse();
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action: 'input-unknown',
}), res);
expect(res.statusCode).to.be.equal(200);
Expand All @@ -46,7 +46,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.true;
expect(res.speech()).to.contain(
Expand All @@ -68,7 +68,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.false;
expect(res.speech()).to.contain(strings.intents.unknown[2].speech);
Expand All @@ -85,7 +85,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.true;
expect(res.speech()).to.contain(strings.intents.unknown[0].speech);
Expand Down
8 changes: 4 additions & 4 deletions functions/tests/integration/no-input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('integration', () => {
describe('no-input', () => {
it('should 1st time', () => {
const res = new MockResponse();
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action: 'no-input',
}), res);
expect(res.statusCode).to.be.equal(200);
Expand All @@ -41,7 +41,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.true;
expect(res.speech()).to.contain(
Expand All @@ -60,7 +60,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.false;
expect(res.speech()).to.contain(strings.intents.noInput[2].speech);
Expand All @@ -77,7 +77,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.true;
expect(res.speech()).to.contain(strings.intents.noInput[0].speech);
Expand Down
2 changes: 1 addition & 1 deletion functions/tests/integration/repeat.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('integration', () => {
},
},
});
index.playMedia(req, res);
index.assistant(req, res);
expect(res.statusCode).to.be.equal(200);
expect(res.userResponse()).to.be.true;
expect(res.speech()).to.contain('Where to go?');
Expand Down
4 changes: 2 additions & 2 deletions functions/tests/integration/welcome.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('integration', () => {
describe('welcome', () => {
it('should handle for a new user', () => {
const res = new MockResponse();
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action: 'welcome',
lastSeen: null,
}), res);
Expand All @@ -30,7 +30,7 @@ describe('integration', () => {

it('should handle for return user', () => {
const res = new MockResponse();
index.playMedia(buildIntentRequest({
index.assistant(buildIntentRequest({
action: 'welcome',
}), res);
expect(res.speech()).to.contain('Welcome to music at the Internet Archive.');
Expand Down