source: imaps-frontend/node_modules/has-proto/test/index.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: 640 bytes
Line 
1'use strict';
2
3var test = require('tape');
4var gPO = require('reflect.getprototypeof/polyfill')();
5var gOPD = require('gopd');
6
7var hasProto = require('../');
8
9var getter = require('dunder-proto/get');
10
11test('hasProto', function (t) {
12 var result = hasProto();
13 t.equal(typeof result, 'boolean', 'returns a boolean (' + result + ')');
14
15 var obj = { __proto__: null };
16 if (result) {
17 t.notOk('toString' in obj, 'null object lacks toString');
18 if (gOPD && getter) {
19 t.equal(getter(obj), null);
20 }
21 } else {
22 t.ok('toString' in obj, 'without proto, null object has toString');
23 t.equal(gPO(obj), Object.prototype);
24 }
25
26 t.end();
27});
28
Note: See TracBrowser for help on using the repository browser.