shimmed.js 880 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. require('../auto');
  3. var test = require('tape');
  4. var defineProperties = require('define-properties');
  5. var callBind = require('call-bind');
  6. var functionsHaveNames = require('functions-have-names')();
  7. var isEnumerable = Object.prototype.propertyIsEnumerable;
  8. var runTests = require('./tests');
  9. var name = 'groupBy';
  10. var fullName = 'Object.' + name;
  11. test('shimmed', function (t) {
  12. var fn = Object[name];
  13. t.equal(fn.length, 2, fullName + ' has a length of 2');
  14. t.test('Function name', { skip: !functionsHaveNames }, function (st) {
  15. st.equal(fn.name, name, fullName + ' has name "' + name + '"');
  16. st.end();
  17. });
  18. t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
  19. et.equal(false, isEnumerable.call(Object, name), fullName + ' is not enumerable');
  20. et.end();
  21. });
  22. runTests(callBind(fn, Object), t);
  23. t.end();
  24. });