<commit_before>var http = require('http'),
    Asker = require('../lib/asker'),
    AdvancedAgent = require('../lib/advanced_agent');

module.exports = {
    'inheritance' : function(test) {

        test.done();
    },

    'agents pool usage' : function(test) {

        test.done();
    },

    'agent persistence' : function(test) {

        test.done();
    },

    'removed socket event' : function(test) {

        test.done();
    }
};<commit_msg>advanced_agent tests done<commit_after>var http = require('http'),
    Asker = require('../lib/asker'),
    AdvancedAgent = require('../lib/advanced_agent');

module.exports = {
    'inheritance' : function(test) {
        var agent = new AdvancedAgent();

        test.ok(agent instanceof AdvancedAgent,
            'agent instanceof AdvancedAgent');

        test.ok(agent instanceof http.Agent,
            'agent instanceof http.Agent');

        test.done();
    },

    'agents pool usage' : function(test) {
        var AGENT_NAME = 'smith',
            request1 = new Asker({ agent : { name : AGENT_NAME, persistent : true } }),
            request2 = new Asker({ agent : { name : AGENT_NAME, persistent : false } });

        test.strictEqual(request1.agent, request2.agent,
            'agent reused from pool by name');

        test.strictEqual(request2.agent.options.persistent, true,
            'agent options was not overriden by second declaration');

        delete Asker.agentsPool[AGENT_NAME];

        test.done();
    },

    'agent persistence' : function(test) {
        var AGENT_NAME = 'temp',
            request = new Asker({
                agent : {
                    name : AGENT_NAME,
                    persistent : false
                }
            });

        test.strictEqual(request.agent, Asker.agentsPool[AGENT_NAME],
            'step #1: agent in the pool');

        request = null;

        test.ok(Asker.agentsPool[AGENT_NAME] instanceof AdvancedAgent,
            'step #2: agent still in the pool');

        Asker.agentsPool[AGENT_NAME].emit(AdvancedAgent.EVENTS.SOCKET_REMOVED);

        test.strictEqual(Object.keys(Asker.agentsPool).length, 0,
            'non-persistent agent removed from pool by "' +
                AdvancedAgent.EVENTS.SOCKET_REMOVED +
                '" event');

        test.done();
    }
};
{'fraction_non_alphanumeric': 0.12806188225182638, 'fraction_numerical': 0.0034379028792436614, 'mean_word_length': 2.104, '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': '1321867', 'n_tokens_mistral': 685, 'n_tokens_neox': 645, 'n_words': 144}