<commit_before>var random = require('./randoms');

describe('dot_compiler', function() {

  var fixt = {
    word: random.word(),
    qwer: '{"a":1}',
    dotted: '{{= "asdf" }}',
    dotted_w_params: '{{= it.title }}',
    nested_include: '{{= it.include("asdf") }}'
  };

  var dot = new (require('../lib/dot_compiler'))({
    it: {title: "asdf"},
    template_settings: {}
  });

  it('compiles dot templates', function() {
    var content = '{{= "' + fixt.word + '" }}';
    expect(dot.compile(content)).toEqual(fixt.word);
  });
});<commit_msg>Add tests for it extender<commit_after>var random = require('./randoms');

describe('dot_compiler', function() {

  var fixt = {
    word: random.word(),
    qwer: '{"a":1}',
    dotted: '{{= "asdf" }}',
    dotted_w_params: '{{= it.title }}',
    nested_include: '{{= it.include("asdf") }}'
  };

  var dot = new (require('../lib/dot_compiler'))({
    it: {title: 'asdf'},
    template_settings: {}
  });

  beforeEach(function() {
    dot.it = {title: 'asdf'};
  })

  it('compiles dot templates', function() {
    var content = '{{= "' + fixt.word + '" }}';
    expect(dot.compile(content)).toEqual(fixt.word);
  });

  describe('extend_it', function() {
    it('can add parameters to the it object', function() {
      dot.extend_it({qwer: 22});
      expect(dot.it).toEqual({title: 'asdf', qwer: 22});
    });

    it('can override values in the it object', function() {
      dot.extend_it({asdf: 1}, {title: 2});
      expect(dot.it).toEqual({title: 2, asdf: 1});
    });
  });
});
{'fraction_non_alphanumeric': 0.23292127521145087, 'fraction_numerical': 0.006506180871828237, 'mean_word_length': 3.3446327683615817, 'pattern_counts': {'":': 2, '<': 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': '7510455', 'n_tokens_mistral': 561, 'n_tokens_neox': 543, 'n_words': 106}