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