<commit_before>'use strict';

// MODULES //

var tape = require( 'tape' );
var validate = require( './../lib/validate.js' );


// TESTS //

tape( 'main export is a function', function test( t ) {
	t.ok( true, __filename );
	t.strictEqual( typeof validate, 'function', 'export is a function' );
	t.end();
});

tape( 'the function returns an error if provided an options argument which is not an object', function test( t ) {
	var values;
	var err;
	var i;

	values = [
		null,
		void 0,
		NaN,
		3,
		'3',
		[],
		true,
		function noop() {}
	];

	for ( i = 0; i < values.length; i++ ) {
		err = validate( {}, values[ i ] );
		t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided ' + ( typeof values[ i ] ) + ' as the options argument' );
	}
	t.end();
});

tape( 'the function returns an error if provided a `sep` option argument which is not a string primitive', function test( t ) {
	var values;
	var err;
	var i;

	values = [
		null,
		void 0,
		NaN,
		3,
		new String( '3' ), // eslint-disable-line no-new-wrappers
		[],
		{},
		true,
		function noop() {}
	];

	for ( i = 0; i < values.length; i++ ) {
		err = validate( {}, {
			'sep': values[ i ]
		});
		t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided ' + ( typeof values[ i ] ) + ' as a sep option' );
	}
	t.end();
});

tape( 'the function returns `null` if all options are of valid type (unrecognized options properties)', function test( t ) {
	var opts;
	var obj;

	opts = {
		'foo': true,
		'bar': 'baz'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.deepEqual( obj, {}, 'does not set any properties' );

	t.end();
});

tape( 'the function returns `null` if all options are of valid type ', function test( t ) {
	var opts;
	var obj;

	opts = {
		'sep': '_'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.strictEqual( obj.sep, '_', 'sets sep option as `_`' );

	opts = {
		'sep': '/'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.strictEqual( obj.sep, '/', 'sets sep option as `/`' );

	t.end();
});
<commit_msg>Update tests<commit_after>'use strict';

// MODULES //

var tape = require( 'tape' );
var validate = require( './../lib/validate.js' );


// TESTS //

tape( 'main export is a function', function test( t ) {
	t.ok( true, __filename );
	t.strictEqual( typeof validate, 'function', 'export is a function' );
	t.end();
});

tape( 'the function returns an error if provided an options argument which is not an object', function test( t ) {
	var values;
	var err;
	var i;

	values = [
		'3',
		3,
		NaN,
		true,
		false,
		null,
		void 0,
		[],
		function noop() {}
	];

	for ( i = 0; i < values.length; i++ ) {
		err = validate( {}, values[ i ] );
		t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided '+values[ i ] );
	}
	t.end();
});

tape( 'the function returns an error if provided a `sep` option argument which is not a string primitive', function test( t ) {
	var values;
	var opts;
	var err;
	var i;

	values = [
		new String( '3' ), // eslint-disable-line no-new-wrappers
		3,
		NaN,
		true,
		false,
		null,
		void 0,
		[],
		{},
		function noop() {}
	];

	for ( i = 0; i < values.length; i++ ) {
		opts = {
			'sep': values[ i ]
		};
		err = validate( {}, opts );
		t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided '+values[ i ] );
	}
	t.end();
});

tape( 'the function will ignore unrecognized properties', function test( t ) {
	var opts;
	var obj;

	opts = {
		'foo': true,
		'bar': 'baz'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.deepEqual( obj, {}, 'does not set any properties' );

	t.end();
});

tape( 'the function returns `null` if all options are valid', function test( t ) {
	var opts;
	var obj;

	opts = {
		'sep': '_'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.strictEqual( obj.sep, '_', 'sets option value' );

	opts = {
		'sep': '/'
	};
	obj = {};

	t.strictEqual( validate( obj, opts ), null, 'returns null' );
	t.strictEqual( obj.sep, '/', 'sets option value' );

	t.end();
});

{'fraction_non_alphanumeric': 0.17707585546781526, 'fraction_numerical': 0.00382866714525006, 'mean_word_length': 3.046466602129719, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5219715', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1499, 'n_words': 507}