<commit_before>var should = require('should');
var sinon = require('sinon');
var requirejs = require('../load');


describe('Message',function(){

  var Message;
  var Client;
  var inst;
  var raw;

  var channel;
  var chan_name = 'channel';
  var user;
  var user_name = 'user';
  var text = 'text';


  before(function(done) {
    Message = requirejs('message');
    done();
  });

  beforeEach(function(done) {
    user = { 'name': user_name };
    channel = { 'send': sinon.stub() };
    Client = {};
    raw = { 'channel': channel, 'user': user, 'text': text };
    Client.getChannelGroupOrDMByID = sinon.stub().returns(channel);
    Client.getUserByID = sinon.stub().returns(user);
    inst = new Message(Client, raw);
    done();
  });

  describe('#constructor', function() {
    it('should store the original message as #raw', function() {
      inst.raw.should.equal(raw);
    });
    it('should store the channel as #channel', function() {
      inst.channel.should.equal(channel);
    });
    it('should store the user as #user', function() {
      inst.user.should.equal(user);
    });
    it('should store the message text as #text', function() {
      inst.text.should.equal(text);
    });
  });

  describe('#respond', function() {
    it('should send a message', function(done) {
      inst.respond(text, function() {
        channel.send.calledOnce.should.be.true();
        channel.send.firstCall.args[0].should.equal(text);
        done();
      });
    });
  });<commit_msg>Fixed message tests to work with new botName property<commit_after>var should = require('should');
var sinon = require('sinon');
var requirejs = require('../load');


describe('Message',function(){

  var Message;
  var Client;
  var inst;
  var raw;

  var channel;
  var chan_name = 'channel';
  var user;
  var user_name = 'user';
  var text = 'text';


  before(function(done) {
    Message = requirejs('message');
    done();
  });

  beforeEach(function(done) {
    user = { 'name': user_name };
    channel = { 'send': sinon.stub() };
    Client = {};
    raw = { 'channel': channel, 'user': user, 'text': text };
    Client.getChannelGroupOrDMByID = sinon.stub().returns(channel);
    Client.getUserByID = sinon.stub().returns(user);
    Client.self = {name: 'botname'};
    inst = new Message(Client, raw);
    done();
  });

  describe('#constructor', function() {
    it('should store the original message as #raw', function() {
      inst.raw.should.equal(raw);
    });
    it('should store the channel as #channel', function() {
      inst.channel.should.equal(channel);
    });
    it('should store the user as #user', function() {
      inst.user.should.equal(user);
    });
    it('should store the message text as #text', function() {
      inst.text.should.equal(text);
    });
  });

  describe('#respond', function() {
    it('should send a message', function(done) {
      inst.respond(text, function() {
        channel.send.calledOnce.should.be.true();
        channel.send.firstCall.args[0].should.equal(text);
        done();
      });
    });
  });
{'fraction_non_alphanumeric': 0.17453598176489743, 'fraction_numerical': 0.0006512536633018561, 'mean_word_length': 3.129032258064516, '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': '1017459', 'n_tokens_mistral': 962, 'n_tokens_neox': 947, 'n_words': 225}