text: /**
  * @license Apache-2.0
  *
  * Copyright (c) 2021 The Stdlib Authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  
  'use strict';
  
  // MODULES //
  
  var tape = require( 'tape' );
  var validate = require( './../lib/validate.js' );
  
  
  // TESTS //
  
  tape( 'file exports a validation function', function test( t ) {
  	t.equal( typeof validate, 'function', 'main export is a function' );
  	t.end();
  });
  
  tape( 'if an options argument is not an object, the function returns a type error', function test( t ) {
  	var values;
  	var err;
  	var i;
  
  	values = [
  		'5',
  		5,
  		NaN,
  		null,
  		void 0,
  		true,
  		[],
  		function noop() {}
  	];
  
  	for ( i = 0; i < values.length; i++ ) {
  		err = validate( {}, values[i] );
  		t.ok( err instanceof TypeError, 'returns type error when provided ' + values[i] );
  	}
  	t.end();
  });
  
  tape( 'if provided a `username` option which is not a primitive string, the function returns a type error', function test( t ) {
  	var values;
  	var err;
  	var i;
  
  	values = [
  		5,
  		NaN,
  		null,
  		void 0,
  		true,
  		[],
  		{},
  		function noop() {}
  	];
  
  	for ( i = 0; i < values.length; i++ ) {
  		err = validate( {}, {
  			'username': values[i],
  			'password': 'boop'
  		});
  		t.ok( err instanceof TypeError, 'returns type error when provided ' + values[i] );
  	}
  	t.end();
  });
  
  tape( 'a `username` option is required', function test( t ) {
  	var err = validate( {}, {
  		'password': 'boop'
  	});
  	t.ok( err instanceof TypeError, 'a username option is required' );
  	t.end();
  });
  
  tape( 'if provided a `password` option which is not a primitive string, the function returns a type error', function test( t ) {
  	var values;
  	var err;
  	var i;
  
  	values = [
  		5,
  		NaN,
  		null,
  		void 0,
  		true,
  		[],
  		{},
  		function noop() {}
  	];
  
  	for ( i = 0; i < values.length; i++ ) {
  		err = validate( {}, {
  			'username': 'beep',
  			'password': values[i]
  		});
  		t.ok( err instanceof TypeError, 'returns type error when provided ' + values[i] );
  	}
  	t.end();
  });
  
  tape( 'a `password` option is required', function test( t ) {
  	var err = validate( {}, {
  		'username': 'beep'
  	});
  	t.ok( err instanceof TypeError, 'a password option is required' );
  	t.end();
  });
  
  tape( 'if provided an `otp` option which is not a primitive string, the function returns a type error', function test( t ) {
  	var values;
  	var err;
  	var i;
  
  	values = [
  		5,
  		NaN,
  		null,
  		void 0,
  		true,
  		[],
  		{},
  		function noop() {}
  	];
  
  	for ( i = 0; i < values.length; i++ ) {
  		err = validate( {}, {
  			'username': 'beep',
  			'password': 'boop',
  			'otp': values[i]
  		});
  		t.ok( err instanceof TypeError, 'returns type error when provided ' + values[i] );
  	}
  	t.end();
  });
  
  tape( 'if provided a `useragent` option which is not a primitive string, the function returns a type error', function test( t ) {
  	var values;
  	var err;
  	var i;
  
  	values = [
  		5,
  		NaN,
  		null,
  		void 0,
  		true,
  		[],
  		{},
  		function noop() {}
  	];
  
  	for ( i = 0; i < values.length; i++ ) {
  		err = validate( {}, {
  			'username': 'beep',
  			'password': 'boop',
  			'useragent': values[i]
  		});
  		t.ok( err instanceof TypeError, 'returns type error when provided ' + values[i] );
  	}
  	t.end();
  });
  
  tape( 'the function returns `null` if all options are valid', function test( t ) {
  	var options;
  	var opts;
  	var err;
  
  	options = {
  		'username': 'beep',
  		'password': 'boop',
  		'otp': '1234',
  		'useragent': 'beeper-booper'
  	};
  
  	opts = {};
  	err = validate( opts, options );
  
  	t.equal( err, null, 'returns null' );
  	t.deepEqual( opts, options, 'sets all options' );
  
  	t.end();
  });
  
  tape( 'the function will ignore unrecognized options', function test( t ) {
  	var err;
  
  	err = validate( {}, {
  		'username': 'beep',
  		'password': 'boop',
  		'beep': 'boop',
  		'a': 5,
  		'b': null,
  		'c': 'woot'
  	});
  	t.equal( err, null, 'returns null' );
  
  	t.end();
  });
  