shimmed.js 830 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. require('es5-shim');
  3. var numberIsNaN = require('../');
  4. numberIsNaN.shim();
  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. var runTests = require('./tests');
  10. test('shimmed', function (t) {
  11. t.equal(Number.isNaN.length, 1, 'Number.isNaN has a length of 1');
  12. t.test('Function name', { skip: !functionsHaveNames }, function (st) {
  13. st.equal(Number.isNaN.name, 'isNaN', 'Number.isNaN has name "isNaN"');
  14. st.end();
  15. });
  16. t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
  17. et.equal(false, isEnumerable.call(Number, 'isNaN'), 'Number.isNaN is not enumerable');
  18. et.end();
  19. });
  20. runTests(Number.isNaN, t);
  21. t.end();
  22. });