Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. var test = require('tape');
  3. var isDate = require('./');
  4. var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
  5. test('not Dates', function (t) {
  6. t.notOk(isDate(), 'undefined is not Date');
  7. t.notOk(isDate(null), 'null is not Date');
  8. t.notOk(isDate(false), 'false is not Date');
  9. t.notOk(isDate(true), 'true is not Date');
  10. t.notOk(isDate(42), 'number is not Date');
  11. t.notOk(isDate('foo'), 'string is not Date');
  12. t.notOk(isDate([]), 'array is not Date');
  13. t.notOk(isDate({}), 'object is not Date');
  14. t.notOk(isDate(function () {}), 'function is not Date');
  15. t.notOk(isDate(/a/g), 'regex literal is not Date');
  16. t.notOk(isDate(new RegExp('a', 'g')), 'regex object is not Date');
  17. t.end();
  18. });
  19. test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) {
  20. var realDate = new Date();
  21. var fakeDate = { toString: function () { return String(realDate); }, valueOf: function () { return realDate.getTime(); } };
  22. fakeDate[Symbol.toStringTag] = 'Date';
  23. t.notOk(isDate(fakeDate), 'fake Date with @@toStringTag "Date" is not Date');
  24. t.end();
  25. });
  26. test('Dates', function (t) {
  27. t.ok(isDate(new Date()), 'new Date() is Date');
  28. t.end();
  29. });