Last active
August 28, 2017 23:45
-
-
Save microsoftly/607c0529c204467801dd6fad8d5c7a83 to your computer and use it in GitHub Desktop.
The BotTester framework can inspect session state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { BotTester } = require('bot-tester'); | |
const { expect } = require('chai'); | |
describe('Bot Tester', () => { | |
it('can inspect session state', () => { | |
bot.dialog('/', [(session) => { | |
new Prompts.text(session, 'What would you like to set data to?'); | |
}, (session, results) => { | |
session.userData = { data: results.response }; | |
session.save(); | |
}]); | |
return new BotTester(bot) | |
.sendMessageToBot('Start this thing!', 'What would you like to set data to?') | |
.sendMessageToBotAndExpectSaveWithNoResponse('This is data!') | |
.checkSession((session) => { | |
expect(session.userData).not.to.be.null; | |
expect(session.userData.data).to.be.equal('This is data!'); | |
}) | |
.runTest(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment