-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Example
const unit = require("botbuilder-unit");
const botbuilder = require("botbuilder");
const script = [];
class TestDialog extends botbuilder.SimpleDialog {
constructor() {
super(() => { });
}
}
const dialog = new TestDialog();
unit(dialog, script, {
title: 'Your first test script',
reporter: new unit.BeautyLogReporter()
}).then(() => {
console.log('Script passed');
}, (err) => {
console.error(err);
});Results in :
Error: Unknown type of bot/dialog. Error: {"actions":{}}
Looking at botbuilder-unit.js resolveBot function:
function resolveBot(bot) {
let isWaterfall = ("function" == typeof bot) || Array.isArray(bot);
if (isWaterfall) {
let dialog = bot;
let connector = new TestConnector();
bot = new builder.UniversalBot(connector);
bot.dialog('/', dialog);
} else if (bot instanceof builder.UniversalBot) {
if ( !bot.connector()) {
bot.connector('console', new TestConnector());
}
} else {
throw new Error(`Unknown type of bot/dialog. Error: ${JSON.stringify(bot)}`);
}
return bot;
}Could maybe check for instanceof builder.Dialog, eg:
let isWaterfall = ("function" == typeof bot) || Array.isArray(bot);
let isDialog = bot instanceof builder.Dialog;
if (isWaterfall || isDialog) {
...Would you consider a pull request?
Reactions are currently unavailable