All files / botbuilder-unit/spec attachmentSpec.js

66.67% Statements 20/30
100% Branches 0/0
66.67% Functions 8/12
66.67% Lines 20/30
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   1x 1x   1x 3x 3x                                         1x 1x 1x         1x     1x 1x 1x         1x     1x 1x 1x         1x          
const botFactory = require('./lib/botFactory');
const unit = require('../');
 
const builder= require('botbuilder');
 
describe('Test attachments validations', function () {
  let bot = null;
 
  beforeEach(()=> {
    bot = botFactory();
    bot.dialog('/test', [
      function (session) {
        session.send('Hello');
        var msg = new builder.Message(session);
        msg.text('World!');
        msg.attachmentLayout(builder.AttachmentLayout.carousel)
        msg.attachments([
          new builder.HeroCard(session)
            .title("My Title")
            .subtitle("My Subtitle")
            .images([
              builder.CardImage.create(session, 'Some Url'),
              builder.CardImage.create(session, 'Another Url')])
        ]);
        session.send(msg);
        session.endConversation();
      }
    ]);
  });
 
 
  it('Test compare objects', (done) => {
    let script = require('./scripts/attachments/attachmentScript');
    unit(bot, script, {
      title: 'scripts/attachments/attachmentScript'
    }).then(function () {
      done();
    }, function ( ) {
      fail('Impossible case')
    });
  })
  it('Validate attachment by functions option 1', (done) => {
    let script = require('./scripts/attachments/validateAttachmentWithFunction_1');
    unit(bot, script, {
      title: 'scripts/attachments/validateAttachmentWithFunction_1'
    }).then(function () {
      done();
    }, () => {
      fail('Impossible case')
    });
  })
  it('Validate attachment by functions option 2', (done) => {
    let script = require('./scripts/attachments/validateAttachmentWithFunction_2');
    unit(bot, script, {
      title: 'scripts/attachments/validateAttachmentWithFunction_1'
    }).then(function () {
      done();
    }, () => {
      fail('Impossible case')
    });
  })
 
 
});