main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
640 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var test = require('tape');
|
---|
4 | var gPO = require('reflect.getprototypeof/polyfill')();
|
---|
5 | var gOPD = require('gopd');
|
---|
6 |
|
---|
7 | var hasProto = require('../');
|
---|
8 |
|
---|
9 | var getter = require('dunder-proto/get');
|
---|
10 |
|
---|
11 | test('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.