diff --git a/__tests__/DexIntent.test.ts b/__tests__/DexIntent.test.ts
index 57488df..b1f8286 100644
--- a/__tests__/DexIntent.test.ts
+++ b/__tests__/DexIntent.test.ts
@@ -214,4 +214,36 @@ describe('DexIntent', () => {
It is genderless.
`);
});
+
+ test('GIVEN invalid data THEN returns error response', async () => {
+ // Mocking out the GraphQL warning response
+ jest.spyOn(console, 'warn').mockImplementationOnce(() => undefined);
+ expect.assertions(2);
+
+ const res = await fetch(SERVER)
+ .post('/dexa')
+ .send({
+ request: {
+ type: 'IntentRequest',
+ intent: {
+ name: 'DexIntent',
+ slots: {
+ POKEMON: {
+ name: 'POKEMON',
+ value: 'aklsjdkjlashgdjlhaksgdjaghsdghasjd'
+ }
+ }
+ }
+ }
+ });
+
+ const { ssml } = res.body.response.outputSpeech;
+
+ expect(res.status).toBe(200);
+ expect(ssml).toBe(oneLine`
+ I am sorry but I could not resolve that query.
+ I think you said aklsjdkjlashgdjlhaksgdjaghsdghasjd?
+ Maybe try again, or respond with \"Alexa Cancel\" if you want to stop.
+ `);
+ });
});
diff --git a/__tests__/LaunchIntent.test.ts b/__tests__/LaunchIntent.test.ts
new file mode 100755
index 0000000..d3bb383
--- /dev/null
+++ b/__tests__/LaunchIntent.test.ts
@@ -0,0 +1,34 @@
+import { oneLine } from 'common-tags';
+import fetch from 'supertest';
+import { SERVER, setup, teardown } from './utils';
+
+describe('LaunchIntent', () => {
+ beforeAll(() => {
+ setup();
+ });
+
+ afterAll(() => {
+ teardown();
+ });
+
+ test('GIVEN Request to Launch THEN returns launch blurb', async () => {
+ expect.assertions(2);
+
+ const res = await fetch(SERVER)
+ .post('/dexa')
+ .send({
+ request: {
+ type: 'LaunchRequest'
+ }
+ });
+
+ const { ssml } = res.body.response.outputSpeech;
+
+ expect(res.status).toBe(200);
+ expect(ssml).toBe(oneLine`
+ Welcome to Dexa, your one stop place for PokéDex information.
+ You can start browsing right away by giving me a command, or respond with \"help\" to learn all my commands.
+ If you want to stop Dexa, then respond with \"Alexa Stop\".
+ `);
+ });
+});
diff --git a/src/dexa.ts b/src/dexa.ts
index 42134e0..dedabc6 100644
--- a/src/dexa.ts
+++ b/src/dexa.ts
@@ -295,7 +295,7 @@ export default class extends AlexaApp {
'Welcome to Dexa, your one stop place for PokéDex information.',
'You can start browsing right away by giving me a command, or respond with "help" to learn all my commands.',
'If you want to stop Dexa, then respond with "Alexa Stop".'
- ].join('');
+ ].join(' ');
const reprompt = 'I did not quite catch that, could you repeat it?';
@@ -320,7 +320,7 @@ export default class extends AlexaApp {
private throwQueryErr(res: Response, req: Request, slot: SLOTS) {
const prompt = [
- 'Woops, I could not resolve that query.',
+ 'I am sorry but I could not resolve that query.',
req.slot(slot) ? `I think you said ${removeDiacritics(req.slot(slot))}? ` : '',
'Maybe try again, or respond with "Alexa Cancel" if you want to stop.'
].join(' ');