Skip to content

Instantly share code, notes, and snippets.

View ig-perez's full-sized avatar

Iván G. Pérez ig-perez

View GitHub Profile
@ig-perez
ig-perez / e2eTestConfigurationFile.json
Created December 4, 2019 19:05
Bespoken Sample: This is how a testing.json configuration file looks like for end-to-end tests.
{
"type": "e2e",
"findReplace": {
"INVOCATION_NAME": "quick list",
"INVOCATION_NAME_DEV": "quick list development"
},
"homophones": {
"is": ["as", "does", "it's"],
"two": ["to", "2"],
"contestant": ["contested"]
@ig-perez
ig-perez / e2eTestSimpleExample.yml
Created December 4, 2019 19:03
Bespoken Sample: This is how a simple end-to-end test looks like using our YAML-based syntax
---
configuration:
locale: en-US
voiceId: Joanna
---
- test: Launch request, no further interaction
- tags: NLUTest
- <speak>open <phoneme alphabet="ipa" ph="kwɪk lɪst">quick list</phoneme></speak>: "*"
@ig-perez
ig-perez / unitTestEnvVariableSample.js
Created December 4, 2019 19:01
Bespoken Sample: Using the UNIT_TEST environment variable to make your tests more predictably
sessionAttributes.guessNumber = Math.floor(Math.random() * 100);
// For testing purposes, force a number to be picked if the UNIT_TEST environment variable is set
if (process.env.UNIT_TEST) {
sessionAttributes.guessNumber = 50;
}
@ig-perez
ig-perez / unitTestConfigurationFile.json
Created December 4, 2019 18:59
Bespoken Sample: This is how a testing.json file looks like for unit testing
{
"handler": "../../index.js",
"trace": "false",
"jest": {
"silent": true,
"collectCoverageFrom": [
"index.js"
]
},
"include": ["FirstUse"],
@ig-perez
ig-perez / unitTestComplexExample.yml
Created December 4, 2019 18:56
Bespoken Sample: A more complex unit test script.
---
configuration:
locale: en-US
---
- test: Using succinct syntax to invoke the intent with slots.
- tags: FirstUse
- LaunchRequest:
- response.outputSpeech.ssml: /.*how many people are playing today.*/i
- response.shouldEndSession: false
@ig-perez
ig-perez / unitTestSimpleExample.yml
Last active December 4, 2019 18:53
Bespoken Sample: A very simple yet complete unit test script.
---
configuration:
locale: en-US
---
- test: Launching and testing intent with slot values
- LaunchRequest: Welcome to Pet Match
- PetMatchIntent size=small pet=dog:
- prompt:
- Would you prefer a dog to hang out with kids or to protect you?