source: imaps-frontend/node_modules/dunder-proto/test/get.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
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-literal
10 }
11
12 // @ts-expect-error
13 t['throws'](function () { getDunderProto(); }, TypeError, 'throws if no argument');
14 // @ts-expect-error
15 t['throws'](function () { getDunderProto(undefined); }, TypeError, 'throws with undefined');
16 // @ts-expect-error
17 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});
Note: See TracBrowser for help on using the repository browser.