<commit_before>var vows = require('vows'),
should   = require('should'),
util     = require('util'),
diff     = require('../index').diff;

exports.batch = vows.describe('diff').addBatch({
	'A target that has no properties': {
		topic: function() { return {}; },
		'shows no differences when compared to another empty object': function(it) {
			should.not.exist(diff(it, {}));
		},
		'when compared with an object having other properties': {
			topic: function(it) {
				return diff(it, { other: 'property', another: 13.13 });
			},
			'the differences are reported': function(d) {
				should.exist(d);
				d.length.should.eql(2);

				// New property: 'other' = 'property' 
				d[0].should.have.property('kind').eql('N');
				d[0].should.have.property('path').instanceof(Array);
				d[0].path[0].should.eql('other');
				d[0].should.have.property('rhs').eql('property');
				
				// New property: 'another' = 13.13
				d[1].should.have.property('kind').eql('N');
				d[1].should.have.property('path').instanceof(Array);
				d[1].path[0].should.eql('another');
				d[1].should.have.property('rhs').eql(13.13);

			}
		}
	},
	'A target that has one property': {
		topic: function() { return { one: 'property' }; },
		'shows no differences when compared to itself': function(it) {
			should.not.exist(diff(it,it)); 
		},
		'shows the property as removed when compared to an empty object': function(it) {
			var d = diff(it, {});
			d.length.should.eql(1);
			d[0].should.have.property('kind').eql('D');
		}

	},
	'A target that has null value': {
		topic: function () { return { key: null }; },
		'shows no differences when compared to itself': function (it) {
			should.not.exist(diff(it, it));
		}
	}

});
<commit_msg>Adding a few more tests for sanity<commit_after>var vows = require('vows'),
should   = require('should'),
util     = require('util'),
diff     = require('../index').diff;

exports.batch = vows.describe('diff').addBatch({
	'A target that has no properties': {
		topic: function() { return {}; },
		'shows no differences when compared to another empty object': function(it) {
			should.not.exist(diff(it, {}));
		},
		'when compared with an object having other properties': {
			topic: function(it) {
				return diff(it, { other: 'property', another: 13.13 });
			},
			'the differences are reported': function(d) {
				should.exist(d);
				d.length.should.eql(2);

				// New property: 'other' = 'property' 
				d[0].should.have.property('kind').eql('N');
				d[0].should.have.property('path').instanceof(Array);
				d[0].path[0].should.eql('other');
				d[0].should.have.property('rhs').eql('property');
				
				// New property: 'another' = 13.13
				d[1].should.have.property('kind').eql('N');
				d[1].should.have.property('path').instanceof(Array);
				d[1].path[0].should.eql('another');
				d[1].should.have.property('rhs').eql(13.13);

			}
		}
	},
	'A target that has one property': {
		topic: function() { return { one: 'property' }; },
		'shows no differences when compared to itself': function(it) {
			should.not.exist(diff(it,it)); 
		},
		'shows the property as removed when compared to an empty object': function(it) {
			var d = diff(it, {});
			d.length.should.eql(1);
			d[0].should.have.property('kind').eql('D');
		},
		'shows the property as edited when compared to an object with null': function (it) {
			var d = diff(it, { one: null });
			d.length.should.eql(1);
			d[0].should.have.property('kind').eql('E');
		}

	},
	'A target that has null value': {
		topic: function () { return { key: null }; },
		'shows no differences when compared to itself': function (it) {
			should.not.exist(diff(it, it));
		},
		'shows the property as removed when compared to an empty object': function (it) {
			var d = diff(it, {});
			d.length.should.eql(1);
			d[0].should.have.property('kind').eql('D');
		},
		'shows the property is changed when compared to an object that has value': function (it) {
			var d = diff(it, { key: 'value' });
			d.length.should.eql(1);
			d[0].should.have.property('kind').eql('E');
		}
	}

});

{'fraction_non_alphanumeric': 0.1952662721893491, 'fraction_numerical': 0.013806706114398421, 'mean_word_length': 3.5686936936936937, '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': '2594811', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1382, 'n_words': 325}