bespoken / bst

:wrench: Bespoken Tools - Tools for making voice apps faster and better
https://bespoken.io
Apache License 2.0
191 stars 20 forks source link

bst init to create test that works with "hello world" template #629

Open habuma opened 4 years ago

habuma commented 4 years ago

Is your feature request related to a problem? Please describe. bst init is great for bootstrapping a project for BST testing. But when setting up unit testing for Alexa, the test doesn't work out of the box.

Obviously, bst init can't anticipate what any existing skill code may do, but since its out-of-the-box test attempts to be a test for a "hello world" app, it might as well be consistent with what the "hello world" template at https://github.com/alexa/skill-sample-nodejs-hello-world gives.

Moreover, since bst init creates tests and testing.json in test/unit, the default name/path for the handler file (index.js) won't work out-of-the-box. I either must enter "../../lambda/custom/index.js" or manually edit testing.json after initialization to change the path to "../../lambda/custom/index.js".

Describe the solution you'd like I'd like for the index.test.js to look like this after bst init:

---
configuration:
  description: My first unit test suite
---
- test : Launch and ask for help
- LaunchRequest : 
  - prompt: "Welcome, you can say Hello or Help. Which would you like to try?"
- AMAZON.HelpIntent :
  - prompt : "You can say hello to me! How can I help?"

This test will immediately pass when applied to a new project based on the "hello world" template. In this form, it no longer uses the project name entered in the prompts from bst init, so that prompt could be removed or could be repurposed for use in the configuration.description.

I'd also like the handler file to default to "../../lambda/custom/index.js" so that I don't have to enter that path myself or manually edit testing.json.

In short, I want to do ask new, select the "hello world" template, then bst init, and finally bst test and have the test pass with no manual editing.

Describe alternatives you've considered The alternatives are for me to manually tweak index.test.js and testing.json to align with what the "hello world" skill generates out of the box.

Additional context n/a

dmarvp commented 4 years ago

hi @habuma , thanks for these suggestions. They make sense to me, I think we'll make some small adjustments to them and implement them on a future sprint.