<commit_before>require('../dist/array_extensions');
var assert = require('chai').assert;
var sinon = require('sinon');
var jsonfile  =require('jsonfile');

var file = './fixtures/data.json';
var fixtures = jsonfile.readFileSync(file);


describe('Array #max', function () {
	it('Should return empty', function () {
		//Execute
		var result = fixtures.arrayEmpty.max();

		//Compare
		assert.equal(result, null);
	});

	it('Should use comparator to find max element', function() {
		//Setup
		var expected = { "name": "pablo", "age": 20 };
		var callback = function(a, b) {
			return a.age - b.age;
		};

		//Execute
		var result = fixtures.peopleRandom.max(callback);

		// Compare
		assert.deepEqual(expected, result);
	});

	it('Should use comparator to find max element in different order', function() {
		//Setup
		var expected = { name: 'pedro', age: 19 };
		var callback = function(a, b) {
			return a.age - b.age;
		};

		//Execute
		var result = fixtures.people.max(callback);

		//Compare
		assert.deepEqual(expected, result);

	});

	it('Should return first element', function() {
		//Execute
		var result = fixtures.numbers.max();

		//Compare
		assert.equal(result, 5);
	});
});<commit_msg>Reformat test_max<commit_after>require('../dist/array_extensions');
var assert = require('chai').assert;
var sinon = require('sinon');
var jsonfile  =require('jsonfile');

var file = './fixtures/data.json';
var fixtures = jsonfile.readFileSync(file);


describe('Array #max', function () {
	it('Should return empty', function () {
		//Execute
		let result = fixtures.arrayEmpty.max();

		//Compare
		assert.equal(result, null);
	});

	it('Should use comparator to find max element', function() {
		//Setup
		let expected = { "name": "pablo", "age": 20 };
		let callback = (a, b) => a.age - b.age;

		//Execute
		let result = fixtures.peopleRandom.max(callback);

		// Compare
		assert.deepEqual(expected, result);
	});

	it('Should use comparator to find max element in different order', function() {
		//Setup
		let expected = { name: 'pedro', age: 19 };
		let callback = (a, b) => a.age - b.age;

		//Execute
		var result = fixtures.people.max(callback);

		//Compare
		assert.deepEqual(expected, result);

	});

	it('Should return first element', function() {
		//Execute
		let result = fixtures.numbers.max();

		//Compare
		assert.equal(result, 5);
	});
});
{'fraction_non_alphanumeric': 0.17089678510998307, 'fraction_numerical': 0.004230118443316413, 'mean_word_length': 3.6372549019607843, 'pattern_counts': {'":': 4, '<': 3, '<?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': '5784799', 'n_tokens_mistral': 841, 'n_tokens_neox': 738, 'n_words': 205}