<commit_before>/*global describe, it*/
'use strict';

var assert = require('chai').assert;

describe('core/agent', function () {
    /*eslint max-nested-callbacks: [2, 4]*/
    var Agent = require('../core/agent');
    var Unit = require('../core/unit');

    it('Should be an instance of core/agent', function () {
        var EventEmitter = require('events').EventEmitter;
        var agent = new Agent({x: 42});
        assert.property(agent, 'params');
        assert.isObject(agent.params);
        assert.property(agent.params, 'x');
        assert.strictEqual(agent.params.x, 42);
        assert.instanceOf(agent, EventEmitter);
        assert.instanceOf(agent, Agent);
        assert.isObject(agent.units);
    });

    describe('.alias', function () {
        it('Should create alias', function (done) {
            var agent = new Agent();
            agent.unit({
                path: 'foo'
            });

            agent.alias('foo', 'bar');

            agent.ready().done(function () {
                assert.ok(agent.getUnit('foo'));
                assert.ok(agent.getUnit('bar'));
                done();
            });
        });
<commit_msg>Add test for Agent.prototype.getUnit method<commit_after>/*global describe, it*/
'use strict';

var assert = require('chai').assert;

describe('core/agent', function () {
    /*eslint max-nested-callbacks: [2, 4]*/
    var Agent = require('../core/agent');
    var Unit = require('../core/unit');

    it('Should be an instance of core/agent', function () {
        var EventEmitter = require('events').EventEmitter;
        var agent = new Agent({x: 42});
        assert.property(agent, 'params');
        assert.isObject(agent.params);
        assert.property(agent.params, 'x');
        assert.strictEqual(agent.params.x, 42);
        assert.instanceOf(agent, EventEmitter);
        assert.instanceOf(agent, Agent);
        assert.isObject(agent.units);
    });

    describe('.getUnit', function () {
        it('Should return unit', function () {
            var agent = new Agent();

            agent.unit({
                path: 'foo'
            });

            agent.ready().done(function () {
                assert.instanceOf(agent.getUnit('foo'), Unit);
            });
        });
    });

    describe('.alias', function () {
        it('Should create alias', function (done) {
            var agent = new Agent();
            agent.unit({
                path: 'foo'
            });

            agent.alias('foo', 'bar');

            agent.ready().done(function () {
                assert.ok(agent.getUnit('foo'));
                assert.ok(agent.getUnit('bar'));
                done();
            });
        });

{'fraction_non_alphanumeric': 0.16537180910099888, 'fraction_numerical': 0.004439511653718091, 'mean_word_length': 1.9487459105779716, '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': '1831130', 'n_tokens_mistral': 758, 'n_tokens_neox': 730, 'n_words': 154}