{"size": 1059, "ext": "js", "max_stars_repo_path": "libs/jsx-tools/node_modules/commoner/node_modules/whiskey/node_modules/magic-templates/tests/run2.js", "max_stars_repo_name": "bbondy/brianbondy.gae", "max_stars_repo_stars_event_min_datetime": "2015-01-02T18:08:15.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-15T11:43:11.000Z", "max_issues_repo_path": "libs/jsx-tools/node_modules/commoner/node_modules/whiskey/node_modules/magic-templates/tests/run2.js", "max_issues_repo_name": "bbondy/brianbondy.gae", "max_issues_repo_issues_event_min_datetime": "2018-06-08T05:42:10.000Z", "max_issues_repo_issues_event_max_datetime": "2018-06-08T05:42:10.000Z", "max_forks_repo_path": "libs/jsx-tools/node_modules/commoner/node_modules/whiskey/node_modules/magic-templates/tests/run2.js", "max_forks_repo_name": "bbondy/brianbondy.gae", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 19.2545454545, "max_line_length": 64, "alphanum_fraction": 0.62700661}
/*
 Test for http://github.com/skid/strobe-templates/issues#issue/1
 */

var util = require('util');
var path = require('path');
var assert = require('assert');

var T = require('../index')

T.setTemplatesDir( __dirname );

var template = new T.Template(path.join('test.html'));

function do_render() {
  template.load(function (err, template) {
    if (err) {
      util.log(err);
      return;
    }

    template.render({}, function (err, rendered_template) {
      if (err) {
        util.log(err);
        return;
      }

      after_render(rendered_template);
      return;
    })
  })
}

var i = 0;
var rendered_template_length, new_length;
function after_render(rendered_template) {
  if (i < 5) {
    new_length = rendered_template.length;

    if (i == 0) {
      rendered_template_length = new_length;
    }

    assert.equal(new_length, rendered_template_length,
    'Rendered template length after call #' + i +
    ' is not the same as the after the first call');

    util.log(rendered_template);
    do_render();
    i++;
  }
}

do_render();
