How to use the tape.Test.prototype function in tape

To help you get started, we’ve selected a few tape examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukeed / trouter / test / index.js View on Github external
import { test, Test } from 'tape';
import Trouter from '../';

const hasNamedGroups = 'groups' in 'x'.match(/x/);

const noop = () => {};
const METHODS = ['GET', 'HEAD', 'PATCH', 'OPTIONS', 'CONNECT', 'DELETE', 'TRACE', 'POST', 'PUT'];

Object.assign(Test.prototype, {
	isEmpty(val, msg) {
		this.ok(!Object.keys(val).length, msg);
	},
	isString(val, msg) {
		this.is(typeof val, 'string', msg);
	},
	isArray(val, msg) {
		this.ok(Array.isArray(val), msg);
	},
	isObject(val, msg) {
		this.ok(Boolean(val) && (val.constructor === Object), msg);
	},
	isFunction(val, msg) {
		this.is(typeof val, 'function', msg);
	},
	isRoute(val, obj={}) {