You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the way the conversation is executed mocha hooks like beforeEach are not actually executed before tests run
For example in the following code the UserStorage class has get and put methods that make requests to DynamoDB. I would like to mock those methods using simple mock
constUser=require('../services/User');constUserStorage=require('../services/UserStorage');constsimple=require('simple-mock');constconversation=require('alexa-conversation');constapp=require('../skill');// your Alexa skill's main file.describe('Launch',()=>{constopts={// those will be used to generate the requests to your skillname: 'Set name',appId: 'your-app-id',
app,};beforeEach(()=>{simple.mock(UserStorage.prototype,'get').resolveWith(newUser());simple.mock(UserStorage.prototype,'put').resolveWith();});afterEach(()=>{simple.restore();});// initialize the conversationconversation(opts).userSays('LaunchIntent')// trigger the first Intent.ssmlResponse.shouldMatch(/WelcometoQuizduell/).shouldContain('What should be your Game name?').userSays('NameIntent',{name: 'andres'}).ssmlResponse.shouldContain('I am not quite sure if I\nunderstood correctly. Is it andres?').userSays('AMAZON.YesIntent').ssmlResponse.shouldContain('All right, let\'s go. Ask me your questions or start a new game').end();});
The text was updated successfully, but these errors were encountered:
Due to the way the conversation is executed mocha hooks like beforeEach are not actually executed before tests run
For example in the following code the
UserStorage
class hasget
andput
methods that make requests to DynamoDB. I would like to mock those methods using simple mockThe text was updated successfully, but these errors were encountered: