<commit_before>'use strict';

var fs = require('fs');
var assert = require('assert');
var postcss = require('postcss');
var PostcssTurboCarto = require('../../src/postcss-turbo-carto');
var DummyDatasource = require('../support/dummy-datasource');

var datasource = new DummyDatasource();

var postcssTurboCarto = new PostcssTurboCarto(datasource);

var scenariosPath = __dirname + '/scenarios';
var scenarios = fs.readdirSync(scenariosPath)
  .filter(function(filename) {
    return filename.match(/.css$/) &&
      !filename.match(/expected.css$/) &&
      !filename.match(/^skip/);
  })
  .map(function(cssFilename) {
    var desc = cssFilename.replace(/\.css$/, '').replace(/-/g, ' ');
    var cartocssFilePath = scenariosPath + '/' + cssFilename;
    var expectedCartocssFilePath = scenariosPath + '/' + cssFilename.replace(/css$/, 'expected.css');

    return {
      desc: desc,
      cartocss: fs.readFileSync(cartocssFilePath, {encoding: 'utf-8'}),
      expectedCartocss: fs.readFileSync(expectedCartocssFilePath, {encoding: 'utf-8'})
    };
  });


describe('color-ramp', function () {

  function getCartoCss (cartocss, callback) {
    postcss([postcssTurboCarto.getPlugin()])
      .process(cartocss)
      .then(function (result) {
        return callback(null, result.css);
      })
      .catch(function (err) {
        return callback(err);
      });
  }

  scenarios.forEach(function(scenario) {
    it(scenario.desc, function (done) {
      getCartoCss(scenario.cartocss, function(err, cartocssResult) {
        if (err) {
          return done(err);
        }
        assert.equal(cartocssResult, scenario.expectedCartocss);
        done();
      });
    });
  });

});<commit_msg>Better describe<commit_after>'use strict';

var fs = require('fs');
var assert = require('assert');
var postcss = require('postcss');
var PostcssTurboCarto = require('../../src/postcss-turbo-carto');
var DummyDatasource = require('../support/dummy-datasource');

var datasource = new DummyDatasource();

var postcssTurboCarto = new PostcssTurboCarto(datasource);

var scenariosPath = __dirname + '/scenarios';
var scenarios = fs.readdirSync(scenariosPath)
  .filter(function(filename) {
    return filename.match(/.css$/) &&
      !filename.match(/expected.css$/) &&
      !filename.match(/^skip/);
  })
  .map(function(cssFilename) {
    var desc = cssFilename.replace(/\.css$/, '').replace(/-/g, ' ');
    var cartocssFilePath = scenariosPath + '/' + cssFilename;
    var expectedCartocssFilePath = scenariosPath + '/' + cssFilename.replace(/css$/, 'expected.css');

    return {
      desc: desc,
      cartocss: fs.readFileSync(cartocssFilePath, {encoding: 'utf-8'}),
      expectedCartocss: fs.readFileSync(expectedCartocssFilePath, {encoding: 'utf-8'})
    };
  });


describe('ramp', function () {

  function getCartoCss (cartocss, callback) {
    postcss([postcssTurboCarto.getPlugin()])
      .process(cartocss)
      .then(function (result) {
        return callback(null, result.css);
      })
      .catch(function (err) {
        return callback(err);
      });
  }

  scenarios.forEach(function(scenario) {
    it(scenario.desc, function (done) {
      getCartoCss(scenario.cartocss, function(err, cartocssResult) {
        if (err) {
          return done(err);
        }
        assert.equal(cartocssResult, scenario.expectedCartocss);
        done();
      });
    });
  });

});
{'fraction_non_alphanumeric': 0.16215420835785757, 'fraction_numerical': 0.0011771630370806356, 'mean_word_length': 3.3632862644415917, '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': '6411236', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1091, 'n_words': 187}