All files / botbuilder-unit/spec BotAcceptanceSpec.js

71.88% Statements 23/32
100% Branches 0/0
38.46% Functions 5/13
71.88% Lines 23/32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 641x 1x   1x     3x                 3x       1x     1x 1x 1x 1x   1x           1x 1x 1x 1x   1x       1x           1x 1x 1x 1x   1x       1x            
const botFactory = require('./lib/botFactory');
const unit = require('../');
 
const botbuilder =require('botbuilder');
 
function addDefaultDialogs( bot ) {
  bot.dialog('/test', [
    function (session) {
      session.send('Test dialog welcomes you!')
      session.beginDialog('/testB');
    },
    function ( session ) {
      session.endDialog('End of test dialog')
    }
  ])
  bot.dialog('/testB', function (session) {
    session.endDialog('TestB wialog welcomes you!')
  });
}
describe('Basic Test Suite: text user/bot messages with user', function () {
 
 
  it('Should support `user` and `bot` attributes', function (done) {
    let bot = botFactory();
    let script = require('./scripts/base');
    addDefaultDialogs(bot);
 
    unit( bot, script, {
      title: 'Should support `user` and `bot` attributes'
    } ).then( function () {
      done();
    });
  });
  it('Test that connector added by default', (done) => {
    let bot = new botbuilder.UniversalBot();
    let script = require('./scripts/base');
    addDefaultDialogs(bot);
 
    bot.dialog('/', function (session) {
      session.beginDialog('/test');
    });
 
    unit( bot, script, {
      title: 'Test that connector added by defaul'
    } ).then( function () {
      done();
    });
  });
  it('Test that if any connector already used, testconnector will be not unit', (done) => {
    let bot = new botbuilder.UniversalBot(new botbuilder.ConsoleConnector());
    let script = require('./scripts/base');
    addDefaultDialogs(bot);
 
    bot.dialog('/', function (session) {
      session.beginDialog('/test');
    });
 
    unit( bot, script, {
      title: 'Test that connector added by default'
    } ).then( function () {
      done();
    });
  })
})