<commit_before>
var Q = require('q');
var request = require('request');
var util = require('util');

/**
* Constructor for scenario
* @private
* @method scenario
* @param {Object} name
* @param {Object} description
* @param {Object} requests
* @return {Object} description
*/
var scenario = function(name, description, requests) {
    var self = this;
    self.name = name;
    self.description = description;
    self.requests = requests;
    

    var util = require('util');
    /**
    * Run the scenario
    * @private
    * @method run
    * @param {Object} client to use for the scenario
    * @param {Object} cb
    * @return {Object} description
    */
    self.run = function(client, cb) {
        var responses_done = 0;
        var scenario_result = {
            name : self.name,
            description : self.description,
            success : true,
            responses   : []
        };
        for(var index = 0; index < self.requests.length; index++) {
            var time_before_req = new Date();
            do_request(self.requests[index]).then( function(result) {
                scenario_result.responses.push({ url : self.requests[index], success: true, request_time : get_elapsed_time(time_before_req) });
                responses_done++;
                if(responses_done===self.requests.length){
                    cb(scenario_result);
                }
            }).fail( function(result) {
                scenario_result.responses.push({ url : self.requests[index], success: false, request_time : get_elapsed_time(time_before_req) });
                scenario_result.success = false;
                responses_done++;
                if(responses_done===self.requests.length){
                    cb(scenario_result);
                }
            }).catch(function (error) {
                console.log(util.inspect(error));
            }).done();
        }
    }
}

function apply_client_specifics(request_dto, client) {
    for(var h_index =0; h_index < client.headers.length; h.index++) {
        //if(client.headers[h_index]
    }
}
<commit_msg>made the private function apply_client_specifics a public method on the scenario object for unit testing purposes<commit_after>
var Q = require('q');
var request = require('request');
var util = require('util');

/**
* Constructor for scenario
* @private
* @method scenario
* @param {Object} name
* @param {Object} description
* @param {Object} requests
* @return {Object} description
*/
var scenario = function(name, description, requests) {
    var self = this;
    self.name = name;
    self.description = description;
    self.requests = requests;
    

    var util = require('util');
    /**
    * Run the scenario
    * @private
    * @method run
    * @param {Object} client to use for the scenario
    * @param {Object} cb
    * @return {Object} description
    */
    self.run = function(client, cb) {
        var responses_done = 0;
        var scenario_result = {
            name : self.name,
            description : self.description,
            success : true,
            responses   : []
        };
        for(var index = 0; index < self.requests.length; index++) {
            var time_before_req = new Date();
            self.apply_client_specifics(self.requests[index],client);
            do_request(self.requests[index]).then( function(result) {
                scenario_result.responses.push({ url : self.requests[index], success: true, request_time : get_elapsed_time(time_before_req) });
                responses_done++;
                if(responses_done === self.requests.length) {
                    cb(scenario_result);
                }
            }).fail( function(result) {
                scenario_result.responses.push({ url : self.requests[index], success: false, request_time : get_elapsed_time(time_before_req) });
                scenario_result.success = false;
                responses_done++;
                if(responses_done===self.requests.length){
                    cb(scenario_result);
                }
            }).catch(function (error) {
                console.log(util.inspect(error));
            }).done();
        }
    }
    self.apply_client_specifics = function(request_dto, client) {
        for(var propertyName in client.headers) {
            if(request_dto.headers[propertyName] === undefined) {
                request_dto.headers[propertyName] = client.headers[propertyName];
            }
        }
        return request_dto;
    }
}



{'fraction_non_alphanumeric': 0.11928031985784096, 'fraction_numerical': 0.0011106175033318525, 'mean_word_length': 2.1688951442646025, 'pattern_counts': {'":': 0, '<': 6, '<?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': '2581722', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1225, 'n_words': 280}