Skip to content

Instantly share code, notes, and snippets.

@microsoftly
Last active August 28, 2017 23:53
Show Gist options
  • Save microsoftly/14624c4ad73365dfd9a880b3d9f5215d to your computer and use it in GitHub Desktop.
Save microsoftly/14624c4ad73365dfd9a880b3d9f5215d to your computer and use it in GitHub Desktop.
const { BotTester } = require('bot-tester');
const { expect } = require('chai');
const defaultAddress = { channelId: 'console',
user: { id: 'user1', name: 'A' },
bot: { id: 'bot', name: 'Bot' },
conversation: { id: 'user1Conversation' }
};
describe ('Bot Tester', () => {
it('can send IMessages to the bot and expect IMessage or string responses', () => {
bot.dialog('/', (session) => session.send(session.message.address.user.name));
const askForUser1Name = new Message()
.text('What is my name?')
.address(defaultAddress)
.toMessage();
const user1ExpectedResponse = new Message()
.text('A')
.address(defaultAddress)
.toMessage();
return new BotTester(bot, defaultAddress)
.sendMessageToBot(askForUser1Name, 'A')
.sendMessageToBot(askForUser1Name, user1ExpectedResponse)
.runTest();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment