<commit_before>'use strict';

var assert = require('assert');
var Metalsmith = require('metalsmith');
var strftime = require('strftime');
var timestamp = require('./');
var test;

function run (opts, cb) {
	Metalsmith('fixtures/html')
	.use(timestamp(opts || {}))
	.use(test())
	.build(function (err) {
		if (err) {
			throw err;
		}
		cb();
	});
}

it('should add timestamp to html file', function (cb) {
	test = function () {
		return function (files, metalsmith, done) {
			var file = files['index.html'].contents.toString();
			assert(!!file.match(/<!-- Genarated on:/));
			done();
		}
	};

	run({}, cb);
});

it('should add timestamp to html file with custom time format', function (cb) {
	test = function () {
		return function (files, metalsmith, done) {
			var file = files['index.html'].contents.toString();
			var regexp = new RegExp('<!-- Genarated on: '+ strftime('%Y') +' -->');
			assert(!!file.match(regexp));
			done();
		}
	};
<commit_msg>fix test<commit_after>'use strict';

var assert = require('assert');
var Metalsmith = require('metalsmith');
var strftime = require('strftime');
var timestamp = require('./');
var test;

function run (opts, cb) {
	Metalsmith('fixtures/html')
	.use(timestamp(opts || {}))
	.use(test())
	.build(function (err) {
		if (err) {
			throw err;
		}
		cb();
	});
}

it('should add timestamp to html file', function (cb) {
	test = function () {
		return function (files, metalsmith, done) {
			var file = files['index.html'].contents.toString();
			assert(!!file.match(/<!-- Generated on:/));
			done();
		}
	};

	run({}, cb);
});

it('should add timestamp to html file with custom time format', function (cb) {
	test = function () {
		return function (files, metalsmith, done) {
			var file = files['index.html'].contents.toString();
			var regexp = new RegExp('<!-- Generated on: '+ strftime('%Y') +' -->');
			assert(!!file.match(regexp));
			done();
		}
	};

{'fraction_non_alphanumeric': 0.2032477737035097, 'fraction_numerical': 0.0, 'mean_word_length': 3.922680412371134, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6373282', 'n_tokens_mistral': 706, 'n_tokens_neox': 631, 'n_words': 171}