source: imaps-frontend/node_modules/has-proto/test/mutator.js

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 870 bytes
Line 
1'use strict';
2
3var test = require('tape');
4var gPO = require('reflect.getprototypeof/polyfill')();
5var gOPD = require('gopd');
6
7var hasProto = require('../');
8var hasProtoMutator = require('../mutator');
9
10var getter = require('dunder-proto/get');
11
12test('hasProtoMutator', function (t) {
13 var result = hasProtoMutator();
14 t.equal(typeof result, 'boolean', 'returns a boolean (' + result + ')');
15
16 var obj = { __proto__: null };
17 if (result) {
18 t.notOk('toString' in obj, 'null object lacks toString');
19 t.equal(gPO(obj), null);
20 if (gOPD && getter) {
21 t.equal(getter(obj), null);
22 }
23 } else if (hasProto()) {
24 t.notOk('toString' in obj, 'null object lacks toString');
25 if (gOPD && getter) {
26 t.equal(getter(obj), null);
27 }
28 } else {
29 t.ok('toString' in obj, 'without proto, null object has toString');
30 t.equal(gPO(obj), Object.prototype);
31 }
32
33 t.end();
34});
Note: See TracBrowser for help on using the repository browser.