Debian Codegraph @

globalthis/test/shimmed.js

raw
1 'use strict';
2
3 var systemGlobal = require('../');
4 systemGlobal.shim();
5
6 var test = require('tape');
7 var defineProperties = require('define-properties');
8 var isEnumerable = Object.prototype.propertyIsEnumerable;
9
10 var runTests = require('./tests');
11
12 test('shimmed', function (t) {
13 t.equal(typeof global, 'object', 'global is an object');
14 t.equal('global' in global, true, 'global is in global');
15
16 t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
17 et.equal(false, isEnumerable.call(global, 'global'), 'global.global is not enumerable');
18 et.end();
19 });
20
21 t.test('writability', { skip: !defineProperties.supportsDescriptors }, function (wt) {
22 var desc = Object.getOwnPropertyDescriptor(global, 'global');
23 wt.equal(desc.writable, false, 'global.global is not writable');
24 wt.end();
25 });
26
27 runTests(global.global, t);
28
29 t.end();
30 });