<commit_before>require('../../support/test_helper');

var assert = require('../../support/assert');
var testClient = require('./support/test_client');

var PortedServerOptions = require('./support/ported_server_options');
var BaseController = require('../../../lib/cartodb/controllers/base');

describe('wrap x coordinate', function() {

    var req2paramsFn;
    before(function() {
        req2paramsFn = BaseController.prototype.req2params;
        BaseController.prototype.req2params = PortedServerOptions.req2params;
    });

    after(function() {
        BaseController.prototype.req2params = req2paramsFn;
    });

    describe('renders correct tile', function() {
        var IMG_TOLERANCE_PER_MIL = 20;

        function plainTorqueMapConfig(plainColor) {
            return {
                version: '1.2.0',
                layers: [
                    {
                        type: 'plain',
                        options: {
                            color: plainColor
                        }
                    },
                    {
                        type: 'torque',
                        options: {
                            sql: "SELECT * FROM populated_places_simple_reduced " +
                                "where the_geom && ST_MakeEnvelope(-90, 0, 90, 65)",
                            cartocss: [
                                'Map {',
                                '    buffer-size:0;',
                                '    -torque-frame-count:1;',
                                '    -torque-animation-duration:30;',
                                '    -torque-time-attribute:"cartodb_id";',
                                '    -torque-aggregation-function:"count(cartodb_id)";',
                                '    -torque-resolution:1;',
                                '    -torque-data-aggregation:linear;',
                                '}',
                                '#populated_places_simple_reduced{',<commit_msg>Remove redis keys after each test<commit_after>var testHelper = require('../../support/test_helper');

var assert = require('../../support/assert');
var testClient = require('./support/test_client');

var PortedServerOptions = require('./support/ported_server_options');
var BaseController = require('../../../lib/cartodb/controllers/base');

describe('wrap x coordinate', function() {

    var req2paramsFn;
    before(function() {
        req2paramsFn = BaseController.prototype.req2params;
        BaseController.prototype.req2params = PortedServerOptions.req2params;
    });

    after(function() {
        BaseController.prototype.req2params = req2paramsFn;
    });

    afterEach(function(done) {
        testHelper.deleteRedisKeys({'user:localhost:mapviews:global': 5}, done);
    });

    describe('renders correct tile', function() {
        var IMG_TOLERANCE_PER_MIL = 20;

        function plainTorqueMapConfig(plainColor) {
            return {
                version: '1.2.0',
                layers: [
                    {
                        type: 'plain',
                        options: {
                            color: plainColor
                        }
                    },
                    {
                        type: 'torque',
                        options: {
                            sql: "SELECT * FROM populated_places_simple_reduced " +
                                "where the_geom && ST_MakeEnvelope(-90, 0, 90, 65)",
                            cartocss: [
                                'Map {',
                                '    buffer-size:0;',
                                '    -torque-frame-count:1;',
                                '    -torque-animation-duration:30;',
                                '    -torque-time-attribute:"cartodb_id";',
                                '    -torque-aggregation-function:"count(cartodb_id)";',
                                '    -torque-resolution:1;',
                                '    -torque-data-aggregation:linear;',
                                '}',
                                '#populated_places_simple_reduced{',
{'fraction_non_alphanumeric': 0.11549636803874092, 'fraction_numerical': 0.011864406779661017, 'mean_word_length': 1.2150134048257373, '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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5033526', 'n_tokens_mistral': 1080, 'n_tokens_neox': 989, 'n_words': 146}