CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
get.js35 linesDownload Raw Back to test
1'use strict';2 3var test = require('tape');4 5var getDunderProto = require('../get');6 7test('getDunderProto', { skip: !getDunderProto }, function (t) {8	if (!getDunderProto) {9		throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal10	}11 12	// @ts-expect-error13	t['throws'](function () { getDunderProto(); }, TypeError, 'throws if no argument');14	// @ts-expect-error15	t['throws'](function () { getDunderProto(undefined); }, TypeError, 'throws with undefined');16	// @ts-expect-error17	t['throws'](function () { getDunderProto(null); }, TypeError, 'throws with null');18 19	t.equal(getDunderProto({}), Object.prototype);20	t.equal(getDunderProto([]), Array.prototype);21	t.equal(getDunderProto(function () {}), Function.prototype);22	t.equal(getDunderProto(/./g), RegExp.prototype);23	t.equal(getDunderProto(42), Number.prototype);24	t.equal(getDunderProto(true), Boolean.prototype);25	t.equal(getDunderProto('foo'), String.prototype);26 27	t.end();28});29 30test('no dunder proto', { skip: !!getDunderProto }, function (t) {31	t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');32 33	t.end();34});35