<commit_before>'use strict';

var winston = require('winston');

var ScriptRunner = function(service,options){
	this.service = service;
	this.options = options || {};
};

ScriptRunner.prototype.run = function(method,script,options,cb){

	// If there is no incoming authentication, use ours
	if(!options.auth){
		options.auth = this.options.auth;
	}

	if(!options.logger){
		options.logger = new (winston.Logger)();
	}

	return this.service.runMethod(method,script,options,cb);
};


module.exports = ScriptRunner;<commit_msg>Add basic mock of scriptrunner<commit_after>'use strict';

var winston = require('winston');

var ScriptRunner = function(service,options){
	this.service = service;
	this.options = options || {};
};

var MockScriptStore = function(){
	this.data = {};
};

MockScriptStore.prototype.get = function(key,cb){
	cb(null,(this.data && this.data[key] || null));
};

MockScriptStore.prototype.set = function(key,value,cb){
	this.data[key] = value;
	cb();
};

MockScriptStore.prototype.del = function(key,cb){
	delete this.data[key];
	cb();
};

ScriptRunner.prototype.run = function(method,script,options,cb){

	// If there is no incoming authentication, use ours
	if(!options.auth){
		options.auth = this.options.auth;
	}

	if(!options.logger){
		options.logger = new (winston.Logger)();
	}

	if(!options.scriptStore){
		options.scriptStore = new MockScriptStore;
	}

	return this.service.runMethod(method,script,options,cb);
};


module.exports = ScriptRunner;
{'fraction_non_alphanumeric': 0.15921409214092141, 'fraction_numerical': 0.0, 'mean_word_length': 5.232067510548523, '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': '5481369', 'n_tokens_mistral': 494, 'n_tokens_neox': 471, 'n_words': 92}