source: frontend/node_modules/object.getownpropertydescriptors/test/shimmed.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.4 KB
Line 
1'use strict';
2
3require('../auto');
4
5var getDescriptors = require('../');
6
7var test = require('tape');
8var defineProperties = require('define-properties');
9var runTests = require('./tests');
10var isEnumerable = Object.prototype.propertyIsEnumerable;
11var functionsHaveNames = require('functions-have-names')();
12
13test('shimmed', function (t) {
14 t.equal(Object.getOwnPropertyDescriptors.length, 1, 'Object.getOwnPropertyDescriptors has a length of 1');
15 t.test('Function name', { skip: !functionsHaveNames }, function (st) {
16 st.equal(Object.getOwnPropertyDescriptors.name, 'getOwnPropertyDescriptors', 'Object.getOwnPropertyDescriptors has name "getOwnPropertyDescriptors"');
17 st.end();
18 });
19
20 t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
21 et.equal(false, isEnumerable.call(Object, 'getOwnPropertyDescriptors'), 'Object.getOwnPropertyDescriptors is not enumerable');
22 et.end();
23 });
24
25 var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
26
27 t.test('bad object/this value', { skip: !supportsStrictMode }, function (st) {
28 st['throws'](function () { return getDescriptors(undefined, 'a'); }, TypeError, 'undefined is not an object');
29 st['throws'](function () { return getDescriptors(null, 'a'); }, TypeError, 'null is not an object');
30 st.end();
31 });
32
33 runTests(Object.getOwnPropertyDescriptors, t);
34
35 t.end();
36});
Note: See TracBrowser for help on using the repository browser.