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
import { expect } from 'chai'; | |
import { TapeDeck } from 'mocha-tape-deck'; | |
import { getDogAndCatTitleCount } from './awwCounter'; | |
describe('Aww counter component test', function () { | |
const deck = new TapeDeck('./cassettes'); | |
deck.createTest('Expects 2 cats and 5 dogs when selecting 20 titles', async () => { | |
const { cat, dog } = await getDogAndCatTitleCount(20); |
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
import { expect } from 'chai'; | |
import { getDogAndCatTitleCount } from './awwCounter'; | |
describe('Aww counter', () => { | |
it('Expects 2 cats and 5 dogs when selecting 20 titles', async () => { | |
const { cat, dog } = await getDogAndCatTitleCount(20); | |
expect(cat).to.be.equal(2) | |
expect(dog).to.be.equal(5); | |
}) |
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
import rp = require("request-promise"); | |
function countTitlesWithCatOrDog(titles) { | |
return titles.reduce((accumulator, title) => { | |
if (title.toLowerCase().includes('cat')) { | |
accumulator.cat++ | |
} | |
if (title.toLowerCase().includes('dog')) { | |
accumulator.dog++ |
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('accepts RegExp', () => { | |
const numberRegex = /^\d+/; | |
bot.dialog('/', (session) => { | |
session.send(session.message.text); | |
}); |
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'); | |
const defaultAddress = { channelId: 'console', | |
user: { id: 'user1', name: 'A' }, | |
bot: { id: 'bot', name: 'Bot' }, | |
conversation: { id: 'user1Conversation' } | |
}; | |
describe ('Bot Tester', () => { |
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 do arbitrary work between test steps', () => { | |
let responseString = 'goodbye'; | |
bot.dialog('/', (session) => { | |
// send only numbers for this test case .... | |
session.send(responseString); |
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 test prompts', () => { | |
bot.dialog('/', [(session) => { | |
new Prompts.text(session, 'Hi there! Tell me something you like'); | |
}, (session, results) => { | |
session.send(`${results.response} is pretty cool.`); | |
new Prompts.text(session, 'Why do you like it?'); |
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(); |
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
var assert = require('assert'); | |
var builder = require('../'); | |
describe('dialogs', function () { | |
this.timeout(5000); | |
it('should process a waterfall of all built-in prompt types', function (done) { | |
var step = 0; | |
var connector = new builder.ConsoleConnector(); | |
var bot = new builder.UniversalBot(connector); |