<commit_before>DefaultDirectoryProvider = require "../src/default-directory-provider"
path = require "path"
temp = require "temp"

describe "DefaultDirectoryProvider", ->
  describe ".directoryForURISync(uri)", ->
    it "returns a Directory with a path that matches the uri", ->
      provider = new DefaultDirectoryProvider()
      tmp = temp.mkdirSync()

      directory = provider.directoryForURISync(tmp)
      expect(directory.getPath()).toEqual tmp

    it "normalizes its input before creating a Directory for it", ->
      provider = new DefaultDirectoryProvider()
      tmp = temp.mkdirSync()
      nonNormalizedPath = tmp + path.sep +  ".." + path.sep + path.basename(tmp)
      expect(tmp.contains("..")).toBe false
      expect(nonNormalizedPath.contains("..")).toBe true

      directory = provider.directoryForURISync(nonNormalizedPath)
      expect(directory.getPath()).toEqual tmp
<commit_msg>String.contains is not a standard method in Chrome 41<commit_after>DefaultDirectoryProvider = require "../src/default-directory-provider"
path = require "path"
temp = require "temp"

describe "DefaultDirectoryProvider", ->
  describe ".directoryForURISync(uri)", ->
    it "returns a Directory with a path that matches the uri", ->
      provider = new DefaultDirectoryProvider()
      tmp = temp.mkdirSync()

      directory = provider.directoryForURISync(tmp)
      expect(directory.getPath()).toEqual tmp

    it "normalizes its input before creating a Directory for it", ->
      provider = new DefaultDirectoryProvider()
      tmp = temp.mkdirSync()
      nonNormalizedPath = tmp + path.sep +  ".." + path.sep + path.basename(tmp)
      expect(tmp.includes("..")).toBe false
      expect(nonNormalizedPath.includes("..")).toBe true

      directory = provider.directoryForURISync(nonNormalizedPath)
      expect(directory.getPath()).toEqual tmp

{'fraction_non_alphanumeric': 0.11774193548387096, 'fraction_numerical': 0.001075268817204301, 'mean_word_length': 3.6994949494949494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5440555', 'n_tokens_mistral': 505, 'n_tokens_neox': 484, 'n_words': 130}