'use strict';

// MODULES //

var tape = require( 'tape' );
var getPrototypeOf = require( './../lib' );


// TESTS //

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

tape( 'the function returns `null` if provided either `null` or `undefined`', function test( t ) {
	var proto;

	proto = getPrototypeOf( null );
	t.equal( proto, null, 'returns `null` when provided `null`' );

	proto = getPrototypeOf( void 0 );
	t.equal( proto, null, 'returns `null` when provided `undefined`' );

	t.end();
});

tape( 'the function returns the prototype of a provided value', function test( t ) {
	var expected;
	var values;
	var actual;
	var i;

	values = [
		'beep',
		new String( 'boop' ),
		5,
		new Number( 3.14 ),
		true,
		new Boolean( false ),
		[],
		{},
		function foo() {},
		new Date(),
		/.*/,
		new RegExp( '.*' )
	];

	expected = [
		String.prototype,
		String.prototype,
		Number.prototype,
		Number.prototype,
		Boolean.prototype,
		Boolean.prototype,
		Array.prototype,
		Object.prototype,
		Function.prototype,
		Date.prototype,
		RegExp.prototype,
		RegExp.prototype
	];

	for ( i = 0; i < values.length; i++ ) {
		actual = getPrototypeOf( values[i] );
		t.equal( actual, expected[i], 'returns expected prototype when provided '+values[i] );
	}
	t.end();
});

tape( 'the function returns `null` if provided an object created via `Object.create( null )`', function test( t ) {
	var proto = getPrototypeOf( Object.create( null ) );
	t.equal( proto, null, 'returns null' );
	t.end();
});

'use strict';

// MODULES //

var tape = require( 'tape' );
var getPrototypeOf = require( './../lib' );


// TESTS //

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

tape( 'the function returns `null` if provided either `null` or `undefined`', function test( t ) {
	var proto;

	proto = getPrototypeOf( null );
	t.equal( proto, null, 'returns `null` when provided `null`' );

	proto = getPrototypeOf( void 0 );
	t.equal( proto, null, 'returns `null` when provided `undefined`' );

	t.end();
});

tape( 'the function returns the prototype of a provided value', function test( t ) {
	var expected;
	var values;
	var actual;
	var i;

	values = [
		'beep',
		new String( 'boop' ), // eslint-disable-line no-new-wrappers
		5,
		new Number( 3.14 ), // eslint-disable-line no-new-wrappers
		true,
		new Boolean( false ), // eslint-disable-line no-new-wrappers
		[],
		{},
		function foo() {},
		new Date(),
		/.*/,
		new RegExp( '.*' )
	];

	expected = [
		String.prototype,
		String.prototype,
		Number.prototype,
		Number.prototype,
		Boolean.prototype,
		Boolean.prototype,
		Array.prototype,
		Object.prototype,
		Function.prototype,
		Date.prototype,
		RegExp.prototype,
		RegExp.prototype
	];

	for ( i = 0; i < values.length; i++ ) {
		actual = getPrototypeOf( values[i] );
		t.equal( actual, expected[i], 'returns expected prototype when provided '+values[i] );
	}
	t.end();
});

tape( 'the function returns `null` if provided an object created via `Object.create( null )`', function test( t ) {
	var proto = getPrototypeOf( Object.create( null ) );
	t.equal( proto, null, 'returns null' );
	t.end();
});

Disable lint rule