<commit_before>/*!
 * engine-handlebars <https://github.com/jonschlinkert/engine-handlebars>
 *
 * Copyright (c) 2014 <NAME>, contributors.
 * Licensed under the MIT license.
 */

'use strict';

var fs = require('fs');
var path = require('path');
var should = require('should');
var engine = require('..');


describe('.Handlebars', function () {
  it('should expose the engine.', function () {
    var Handlebars = engine.Handlebars;
    Handlebars.should.have.properties(['compile', 'SafeString']);
  });

  it('should allow helpers to registered with the engine.', function (done) {
    var Handlebars = engine.Handlebars;
    Handlebars.registerHelper('blah', function (str) {
      return str.toLowerCase();
    });

    var ctx = {name: '<NAME>'};

    // engine.render('{{blah name}}', ctx, function (err, content) {
    //   content.should.equal('<NAME>');
    //   done();
    // });
    engine.render('{{#if foo}}{{name}}{{else}}None.{{/if}}', ctx, function (err, content) {
      console.log(err)
      content.should.equal('None.');
      done();
    });
  });
});


describe('.renderSync()', function () {
  it('should render templates.', function () {
    var str = engine.renderSync('Jon {{ name }}', {name: 'Schlinkert'});
    str.should.equal('<NAME>');
  });
});


describe('.render()', function() {
  it('should render templates.', function(done) {
    var ctx = {name: '<NAME>'};

    engine.render('{{ name }}', ctx, function (err, content) {
      content.should.equal('<NAME>');
      done();
    });
  });

  it('should use helpers passed on the options.', function(done) {
    var ctx = {
      name: '<NAME>',<commit_msg>update test<commit_after>/*!
 * engine-handlebars <https://github.com/jonschlinkert/engine-handlebars>
 *
 * Copyright (c) 2014 <NAME>, contributors.
 * Licensed under the MIT license.
 */

'use strict';

var fs = require('fs');
var path = require('path');
var should = require('should');
var engine = require('..');


describe('.Handlebars', function () {
  it('should expose the engine.', function () {
    var Handlebars = engine.Handlebars;
    Handlebars.should.have.properties(['compile', 'SafeString']);
  });

  it('should allow helpers to registered with the engine.', function (done) {
    var Handlebars = engine.Handlebars;
    Handlebars.registerHelper('blah', function (str) {
      return str.toLowerCase();
    });

    var ctx = {name: '<NAME>'};

    engine.render('{{blah name}}', ctx, function (err, content) {
      content.should.equal('<NAME>');
      done();
    });
  });
});


describe('.renderSync()', function () {
  it('should render templates.', function () {
    var str = engine.renderSync('Jon {{ name }}', {name: 'Schlinkert'});
    str.should.equal('<NAME>');
  });
});


describe('.render()', function() {
  it('should render templates.', function(done) {
    var ctx = {name: '<NAME>'};

    engine.render('{{ name }}', ctx, function (err, content) {
      content.should.equal('<NAME>');
      done();
    });
  });

  it('should use helpers passed on the options.', function(done) {
    var ctx = {
      name: '<NAME>',
{'fraction_non_alphanumeric': 0.20283322601416612, 'fraction_numerical': 0.0025756600128783, 'mean_word_length': 3.464080459770115, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '7077244', 'n_tokens_mistral': 956, 'n_tokens_neox': 930, 'n_words': 233}