<commit_before>import sinon from 'sinon';

import Builder from '../../../src/chatbot/builder.js';

describe('Chatbot builder', function() {
    beforeEach(function() {
      this.builder = new Builder({});
      this.session = {
        getInput: sinon.stub(),
      };
    });

    describe('#run', function() {
      it('should return a Promise', function() {
        const ret = this.builder.run({}, {});

        expect(ret).to.be.a('Promise');
      });
    });

    describe('#runAction', function() {
      it('should return a Promise', function() {
        const ret = this.builder.runAction({}, {}, {});

        expect(ret).to.be.a('Promise');
      });

      it('should return an Error when there is no such actionId', function() {
        const action = 'UNDEFINED_ACTION';
        const ret = this.builder.runAction(action, {}, {});

        return expect(ret).to
        .be.rejectedWith('No such action: ' + action);
      });
    });

    describe('#checkIntent', function() {
      it('should return false if intent is undefined', function() {
        const ret = this.builder.checkIntent('UNDEFINED_INTENT', this.session);

        return expect(ret).to.be.false;
      });
    });
});
<commit_msg>format<commit_after>import sinon from 'sinon';

import Builder from '../../../src/chatbot/builder.js';

describe('Chatbot builder', function() {
  beforeEach(function() {
    this.builder = new Builder({});
    this.session = {
      getInput: sinon.stub(),
    };
  });

  describe('#run', function() {
    it('should return a Promise', function() {
      const ret = this.builder.run({}, {});

      expect(ret)
        .to.be.a('Promise');
    });
  });

  describe('#runAction', function() {
    it('should return a Promise', function() {
      const ret = this.builder.runAction({}, {}, {});

      expect(ret)
        .to.be.a('Promise');
    });

    it('should return an Error when there is no such actionId',
      function() {
        const action = 'UNDEFINED_ACTION';
        const ret = this.builder.runAction(action, {}, {});

        return expect(ret)
          .to
          .be.rejectedWith('No such action: ' + action);
      });
  });

  describe('#checkIntent', function() {
    it('should return false if intent is undefined', function() {
      const ret = this.builder.checkIntent('UNDEFINED_INTENT', this
        .session);

      return expect(ret)
        .to.be.false;
    });
  });
});

{'fraction_non_alphanumeric': 0.17845394736842105, 'fraction_numerical': 0.0, 'mean_word_length': 2.4956896551724137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2991532', 'n_tokens_mistral': 725, 'n_tokens_neox': 706, 'n_words': 163}