'use strict';

// MODULES //

var tape = require( 'tape' );
var proxyquire = require( 'proxyquire' );
var isNode = require( './../lib/is_node.js' );


// TESTS //

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

tape( 'the function returns `true` if runtime is Node.js', function test( t ) {
	var isNode = proxyquire('./../lib/is_node.js', {
		'@stdlib/utils/is-object': alwaysTrue,
		'@stdlib/utils/is-string': alwaysTrue
	});
	t.equal( isNode(), true, 'is Node.js' );
	t.end();
		
	/**
	* Returns true.
	* 
	* @example
	* alwaysTrue()
	* // returns true
	*/
	function alwaysTrue() {
		return true;
	} // end FUNCTION alwaysTrue()
});

tape( 'the function returns `false` if runtime is not Node.js', function test( t ) {
	var isNode = proxyquire('./../lib/is_node.js', {
		'@stdlib/utils/is-object': alwaysFalse,
		'@stdlib/utils/is-string': alwaysFalse
	});
	t.equal( isNode(), false, 'is not Node.js' );
	t.end();
	
	/**
	* Returns false.
	* 
	* @example
	* alwaysFalse()
	* // returns false
	*/
	function alwaysFalse() {
		return false;
	} // end FUNCTION alwaysFalse()
});

'use strict';

// MODULES //

var tape = require( 'tape' );
var proxyquire = require( 'proxyquire' );
var isNode = require( './../lib/is_node.js' );


// TESTS //

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

tape( 'the function returns `true` if runtime is Node.js', function test( t ) {
	var isNode = proxyquire('./../lib/is_node.js', {
		'@stdlib/utils/is-object': alwaysTrue,
		'@stdlib/utils/is-string': alwaysTrue
	});
	t.equal( isNode(), true, 'is Node.js' );
	t.end();
		
	/**
	* Returns true.
	* 
	* @private
	* @example
	* alwaysTrue()
	* // returns true
	*/
	function alwaysTrue() {
		return true;
	} // end FUNCTION alwaysTrue()
});

tape( 'the function returns `false` if runtime is not Node.js', function test( t ) {
	var isNode = proxyquire('./../lib/is_node.js', {
		'@stdlib/utils/is-object': alwaysFalse,
		'@stdlib/utils/is-string': alwaysFalse
	});
	t.equal( isNode(), false, 'is not Node.js' );
	t.end();
	
	/**
	* Returns false.
	* 
	* @private
	* @example
	* alwaysFalse()
	* // returns false
	*/
	function alwaysFalse() {
		return false;
	} // end FUNCTION alwaysFalse()
});

Make functions private