UNPKG

auth0-lock

Version:
29 lines (27 loc) 2.02 kB
"use strict"; var _react = _interopRequireDefault(require("react")); var _testUtils = require("testUtils"); var _third_party_captcha = require("../../../field/captcha/third_party_captcha"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } describe('friendly captcha', function () { var wrapper = /*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, { provider: 'friendly_captcha', hl: "en", sitekey: 'mySiteKey' }); it('should match the snapshot', function () { (0, _testUtils.expectComponent)(wrapper).toMatchSnapshot(); }); it('injects the script', function () { var script = _toConsumableArray(window.document.querySelectorAll('script')).find(function (s) { return s.src.startsWith("https://cdn.jsdelivr.net/npm/friendly-challenge@0.9.12/widget.min.js"); }); expect(script).not.toBeUndefined(); }); });