<commit_before>/**
 * Copyright (c) 2013-2018 Memba Sarl. All rights reserved.
 * Sources at https://github.com/Memba
 */

/* jshint node: true, mocha: true, expr: true */

'use strict';

var expect = require('chai').expect;
var util = require('util');
var url = require('url');

var ApplicationError;
try {
    ApplicationError = require('../../../webapp/lib/error');
} catch (exception) {
    ApplicationError = require('../../../api/lib/error');
}

var config;
try {
    config = require('../../../webapp/config');
} catch (exception) {
    config = require('../../../api/config');
}

var error;
try {
    error = require('../../../webapp/middleware/error');
} catch (exception) {
    error = require('../../../api/middleware/error');
}

var locale = 'en';
var whatever = 'whatever';

function Response(options) {
    if (options && options.html) {
        this.getLocale = function () { return locale; };
        this.__ = function () { return whatever; };
        // Make nconf configurations available to our EJS templates
        this.locals = {
            config: config.get(),
            format: util.format,
            url: { join: url.resolve }
        };
    }
}
Response.prototype.status = function (status) {
    this._status = status;
    return this;
};
Response.prototype.set = function (set) {
    this._set = set;
    return this;
};
Response.prototype.vary = function (vary) {
    this._vary = vary;
    return this;
};
Response.prototype.render = function (template, data) {
    this._template = template;
    this._data = data;
    return this;
};
Response.prototype.json = function (json) {
    // Make sure we see what is sent by res.json since stringify might remove properties
    this._json = JSON.parse(JSON.stringify(json));
    return this;
};<commit_msg>Fixed tests<commit_after>/**
 * Copyright (c) 2013-2018 Memba Sarl. All rights reserved.
 * Sources at https://github.com/Memba
 */

/* jshint node: true, mocha: true, expr: true */

'use strict';

var expect = require('chai').expect;
var util = require('util');
var url = require('url');

var ApplicationError;
try {
    ApplicationError = require('../../../webapp/lib/error');
} catch (exception) {
    ApplicationError = require('../../../api/lib/error');
}

var config;
try {
    config = require('../../../webapp/config');
} catch (exception) {
    config = require('../../../api/config');
}

var error;
try {
    error = require('../../../webapp/middleware/error');
} catch (exception) {
    error = require('../../../api/middleware/error');
}

var locale = 'en';
var whatever = 'whatever';

function Response(options) {
    if (options && options.html) {
        this.getLocale = function () { return locale; };
        this.__ = function () { return whatever; };
        // Make nconf configurations available to our EJS templates
        this.locals = {
            config: config.get(),
            format: util.format,
            // moment: require('moment');
            url: url
        };
    }
}
Response.prototype.status = function (status) {
    this._status = status;
    return this;
};
Response.prototype.set = function (set) {
    this._set = set;
    return this;
};
Response.prototype.vary = function (vary) {
    this._vary = vary;
    return this;
};
Response.prototype.render = function (template, data) {
    this._template = template;
    this._data = data;
    return this;
};
Response.prototype.json = function (json) {
    // Make sure we see what is sent by res.json since stringify might remove properties
    this._json = JSON.parse(JSON.stringify(json));
    return this;
};
{'fraction_non_alphanumeric': 0.1678710394663702, 'fraction_numerical': 0.0044469149527515284, 'mean_word_length': 2.6538071065989848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4992578', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1048, 'n_words': 290}