Skip to content

Instantly share code, notes, and snippets.

Avatar

Iván G. Pérez ig-perez

View GitHub Profile
@ig-perez
ig-perez / e2eTestConfigurationFile.json
Created Dec 4, 2019
Bespoken Sample: This is how a testing.json configuration file looks like for end-to-end tests.
View e2eTestConfigurationFile.json
{
"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 Dec 4, 2019
Bespoken Sample: This is how a simple end-to-end test looks like using our YAML-based syntax
View e2eTestSimpleExample.yml
---
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 Dec 4, 2019
Bespoken Sample: Using the UNIT_TEST environment variable to make your tests more predictably
View unitTestEnvVariableSample.js
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 Dec 4, 2019
Bespoken Sample: This is how a testing.json file looks like for unit testing
View unitTestConfigurationFile.json
{
"handler": "../../index.js",
"trace": "false",
"jest": {
"silent": true,
"collectCoverageFrom": [
"index.js"
]
},
"include": ["FirstUse"],
@ig-perez
ig-perez / unitTestComplexExample.yml
Created Dec 4, 2019
Bespoken Sample: A more complex unit test script.
View unitTestComplexExample.yml
---
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 Dec 4, 2019
Bespoken Sample: A very simple yet complete unit test script.
View unitTestSimpleExample.yml
---
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?