ensure-promise.js 592 B

1234567891011121314151617181920
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var promise;
  4. a.throws(function () { t(); }, TypeError);
  5. a.throws(function () { t(null); }, TypeError);
  6. a.throws(function () { t("promise"); }, TypeError);
  7. a.throws(function () { t({}); }, TypeError);
  8. a.throws(function () {
  9. t(function () {});
  10. }, TypeError);
  11. a.throws(function () { t({ then: {} }); }, TypeError);
  12. promise = { then: function () {} };
  13. a(t(promise), promise);
  14. promise = function () {};
  15. promise.then = {};
  16. a.throws(function () { t(promise); }, TypeError);
  17. promise.then = function () {};
  18. a(t(promise), promise);
  19. };