alexa-skill-test-framework
alexa-skill-test-framework copied to clipboard
STATE seems to be ignored
Forgive me if I'm wrong, but I don't see a way to deal with different states. I'm talking about this:
Alexa.CreateStateHandler(States.READY, { // handlers here })
The alexa-skills-kit-sdk-for-nodejs that provides that state logic just stores the state as a session attribute and does the routing internally. The test framework support persisting the session attributes, so it should work fine. Have you tried it out? I'll write up an example when I get a chance.
I have attempted setting state through session, and I am not having success with these attempts being recognized as state changes in my Mocha tests. The following are my attempts that were placed within describe() blocks and before alexa.test([]) blocks...
Through underlying alexa-sdk handler:
alexaTest.index.handler.state = '_STARTMODE';
Through request object's session:
var tState = alexaTest.getIntentRequest('Unhandled')
tState.session.attributes['STATE'] = '_STARTMODE';
Any other thoughts on how state could be setting through the test framework would be greatly appreciated.
@mwklein I'm setting the current state for each test with
alexaTest.test([
{
withStoredAttributes: {
STATE: states.MY_STATE
},
// ...
}
]);
this works for my cases because I'm using dynamodb to store session data.