<commit_before>var util = require('./testUtil');

describe('Populator with empty schema', function () {
	var _connection = {};
	var _options = {};

  before(function(done) {
  	console.log('before');
  	_options.host = 'localhost';
  	_options.port = '27017';
  	_options.db = 'test';
  	_options.collection = 'dataset';
  	_options.schema = 'test/schema_empty.json';
  	util.setUp(_options, function(err, connection) {
  		if(err) return done(err);
  		_connection = connection;
  		done();
  	});
  });

  afterEach(function(done) {
  	console.log('aftereach');
  	_options.size = null;
  	_connection.collection.remove({}, done);
  });

  after(function(done) {
  	console.log('after');
  	util.tearDown(_connection, done);
  });

  // smoke test
  describe('length of data to generate is zero', function() {

  	before(function(done) {
  		console.log('inner before');
	  	_options.size = 0;
	  	util.populator(_options, function() {
	  		done();
	  	});
  	});

		it('should not insert any entry', function (done) {
			console.log('test');
			_connection.collection.count(function (err, count) {
				if (err) done(err);
				util.assert.equal(count, 0);
				done();
			});
		});

  });

  // //
  // describe('length of data to generate is zero', function() {

  // 	before(function(done) {
	 //  	_options.size = 0;
	 //  	util.populator(_options, function() {
	 //  		done();
	 //  	});
  // 	});

		// it('should not insert any entry', function (done) {
		// 	_connection.collection.count(function (err, count) {
		// 		if (err) done(err);
		// 		util.assert.equal(count, 0);
		// 		done();
		// 	});
		// });

  // });


});<commit_msg>correct wrong use of beforeEach<commit_after>var util = require('./testUtil');

describe('Populator with empty schema', function () {
	var _connection = {};
	var _options = {};

  before(function(done) {
  	console.log('before');
  	_options.host = 'localhost';
  	_options.port = '27017';
  	_options.db = 'test';
  	_options.collection = 'dataset';
  	_options.schema = 'test/schema_empty.json';
  	util.setUp(_options, function(err, connection) {
  		if(err) return done(err);
  		_connection = connection;
  		done();
  	});
  });

  after(function(done) {
  	console.log('after');
  	util.tearDown(_connection, done);
  });

  // smoke test
  describe('when size = 0 (smoke test)', function() {

  	before(function(done) {
	  	console.log('before inner 1');
	  	_options.size = 0;
	  	_connection.collection.remove({}, function(err, res) {
	  		if(err) return done(err);
				util.populator(_options, function() {
					done();
				});
	  	});
  	});

		it('should not insert any entry', function (done) {
			console.log('test1-1');
			_connection.collection.count(function (err, count) {
				if (err) return done(err);
				util.assert.equal(count, 0);
				done();
			});
		});

  });

  // basic test
  describe('when size is small', function() {

  	before(function(done) {
  		console.log('test inner 2');
	  	_options.size = 5;
	  	util.populator(_options, function() {
	  		done();
	  	});
  	});

		it('should have the correct size', function (done) {
			console.log('test2-1');
			_connection.collection.count(function (err, count) {
				if (err) return done(err);
				util.assert.equal(count, 5);
				done();
			});
		});

		// it('2', function (done) {
		// 	_connection.collection.count(function (err, count) {
		// 		if (err) return done(err);
		// 		util.assert.equal(count, 5);
		// 		done();
		// 	});
		// });

  });


});
{'fraction_non_alphanumeric': 0.18628013777267508, 'fraction_numerical': 0.007749712973593571, 'mean_word_length': 2.9423076923076925, 'pattern_counts': {'":': 0, '<': 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': '1401494', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1206, 'n_words': 237}