|
| 1 | +System.register([], function (_export, _context) { |
| 2 | + "use strict"; |
| 3 | + |
| 4 | + var symbol; |
| 5 | + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| 6 | + function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } |
| 7 | + function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } |
| 8 | + function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
| 9 | + function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } |
| 10 | + function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } |
| 11 | + function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } |
| 12 | + function objectWithPrimitive(prim) { |
| 13 | + return _defineProperty({}, Symbol.toPrimitive, function () { |
| 14 | + return prim; |
| 15 | + }); |
| 16 | + } |
| 17 | + return { |
| 18 | + setters: [], |
| 19 | + execute: function execute() { |
| 20 | + // Ref: https://github.com/babel/babel/issues/16219 |
| 21 | + |
| 22 | + // delete global.Symbol doesn't work with jest in node 6 |
| 23 | + Object.defineProperty(global, "Symbol", { |
| 24 | + configurable: true, |
| 25 | + writable: true, |
| 26 | + value: undefined |
| 27 | + }); |
| 28 | + require("core-js/modules/es.symbol.js"); |
| 29 | + require("core-js/modules/es.symbol.to-primitive"); |
| 30 | + symbol = Symbol("test"); // Use eval to not let Babel transform this `typeof` |
| 31 | + expect(eval('typeof symbol')).toBe("object"); |
| 32 | + expect(_typeof(symbol)).toBe("symbol"); |
| 33 | + expect(function () { |
| 34 | + var AxiosHeaders = /*#__PURE__*/function (_objectWithPrimitive) { |
| 35 | + "use strict"; |
| 36 | + |
| 37 | + function AxiosHeaders() { |
| 38 | + _classCallCheck(this, AxiosHeaders); |
| 39 | + } |
| 40 | + _createClass(AxiosHeaders, [{ |
| 41 | + key: _objectWithPrimitive, |
| 42 | + value: function value() { |
| 43 | + return; |
| 44 | + } |
| 45 | + }]); |
| 46 | + return AxiosHeaders; |
| 47 | + }(objectWithPrimitive(symbol)); |
| 48 | + }).not.toThrow(); |
| 49 | + expect(function () { |
| 50 | + var AxiosHeaders = /*#__PURE__*/function (_objectWithPrimitive2) { |
| 51 | + "use strict"; |
| 52 | + |
| 53 | + function AxiosHeaders() { |
| 54 | + _classCallCheck(this, AxiosHeaders); |
| 55 | + } |
| 56 | + _createClass(AxiosHeaders, [{ |
| 57 | + key: _objectWithPrimitive2, |
| 58 | + value: function value() { |
| 59 | + return; |
| 60 | + } |
| 61 | + }]); |
| 62 | + return AxiosHeaders; |
| 63 | + }(objectWithPrimitive({})); |
| 64 | + }).toThrow(); |
| 65 | + return "ok"; |
| 66 | + } |
| 67 | + }; |
| 68 | +}); |
0 commit comments