<commit_before>var plugins = require('./../plugins/plugins.js')
  , slack = require('./../lib/slack')
  , paylod = require('./fixtures/payload.json');

describe('Plugins',function(){
  
  var testDir = '../test/fixtures/plugins';

  describe('#load',function(){
    
    it('should return a plugin runner object',function(done){
      var opts = { dir : testDir };
      var target = plugins.load(opts);
      target.should.have.property('run');
      done();
    });

  });

  describe('#run',function(){

    var request = new slack.Request(paylod);

    it('should run plugin that matches slack command',function(done){
      var opts = { dir : testDir };
      var target = plugins.load(opts);
      target.run(request,function(err, message){
        message.should.be.ok;
        message.should.equal("OK");
        done();
      });
    });

  });
});
<commit_msg>Additional unit tests for plugins.js<commit_after>var plugins = require('./../plugins/plugins.js')
  , should = require('chai').should()
  , slack = require('./../lib/slack')
  , paylod = require('./fixtures/payload.json');

describe('Plugins',function(){
  
  var testDir = '../test/fixtures/plugins';

  describe('#load',function(){
    
    it('should return a plugin runner object',function(done){
      var opts = { dir : testDir };
      var target = plugins.load(opts);
      target.should.have.property('run');
      done();
    });

  });

  describe('#run',function(){

    var request = new slack.Request(paylod);

    it('should run plugin that matches slack command',function(done){
      var opts = { dir : testDir };
      var target = plugins.load(opts);
      target.run(request,function(err, message){
        should.not.exist(err);
        message.should.be.ok;
        message.should.equal("OK");
        done();
      });
    });

    it('should callback with error if no method matches the slack command',function(done){
      var opts = { dir : testDir };
      var target = plugins.load(opts);
      request.command = '/bar';
      target.run(request,function(err,message){
        err.should.be.ok;
        done();
      });
    });
  });
});

{'fraction_non_alphanumeric': 0.17586529466791395, 'fraction_numerical': 0.0, 'mean_word_length': 2.726480836236934, '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': '1252472', 'n_tokens_mistral': 642, 'n_tokens_neox': 615, 'n_words': 132}