<commit_before>describe("transformer ", function() {
  // Creates test environment
  require("./setup")({});

  var resolveCaseInsensitivePathToFile = require("../resolveCaseInsensitivePathToFile");
  var fs = require("fs-extra");

  it("resolves case insensitive paths to a file", function(done) {
    var path = "/foo/Bar/baz.jpg";
    var randomizedPath = randomizeCase(path);
    var cwd = this.blogDirectory;

    fs.outputFileSync(cwd + path, "");

    resolveCaseInsensitivePathToFile(cwd, randomizedPath, function(
      err,
      resolvedPath
    ) {
      if (err) return done.fail(err);

      expect(resolvedPath).toEqual(cwd + path);
      done();
    });
  });
});

function randomizeCase(str) {
  return str
    .split("/")
    .map(function(s) {
      for (var i = 0; i < s.length; i++) {
        if (Math.random() > 0.5) {
          s = s.split(s[i]).join(s[i].toLowerCase());
        } else {<commit_msg>Randomized case tests<commit_after>describe("transformer ", function() {
  // Creates test environment
  require("./setup")({});

  var resolveCaseInsensitivePathToFile = require("../resolveCaseInsensitivePathToFile");
  var fs = require("fs-extra");
  var async = require("async");

  it("resolves case insensitive paths to a file", function(done) {
    var cwd = this.blogDirectory;

    // We have to use globally unique names for each directory
    // since on case-insensitive file systems you can clobber
    // an existing test case with a new case
    async.timesSeries(
      100,
      function(i, next) {
        var truePath = global.test.fake.path(Date.now().toString() + ".txt");
        var randomizedPath = randomizeCase(truePath);
        fs.outputFileSync(cwd + truePath, "");

        resolveCaseInsensitivePathToFile(cwd, randomizedPath, function(
          err,
          resolvedPath
        ) {
          if (err) return done.fail(err);

          expect(resolvedPath).toEqual(cwd + truePath);
          fs.emptyDirSync(cwd);
          next();
        });
      },
      done
    );
  });
});

function randomizeCase(str) {
  return str
    .split("/")
    .map(function(s) {
      for (var i = 0; i < s.length; i++) {
        if (Math.random() > 0.5) {
          s = s.split(s[i]).join(s[i].toLowerCase());
        } else {
{'fraction_non_alphanumeric': 0.14845814977973568, 'fraction_numerical': 0.003964757709251102, 'mean_word_length': 2.662903225806452, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6345433', 'n_tokens_mistral': 710, 'n_tokens_neox': 693, 'n_words': 162}