UNPKG

@carbon/ibm-cloud-cognitive-cdai

Version:
32 lines (30 loc) 2 kB
"use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); var jth = _interopRequireWildcard(require("../../component_helpers/jest_test_helper_functions.js")); var _ = require("."); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } // // Copyright IBM Corp. 2020, 2020 // // This source code is licensed under the Apache-2.0 license found in the // LICENSE file in the root directory of this source tree. // describe('IdeAPIKeyGeneration unit tests', function () { var component, unmount; var mountTestComponent = function mountTestComponent() { var defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var test = jth.mountComponent(jth.getJSXForComponent(_.IdeAPIKeyGeneration, defaultProps, props)); component = test.component; unmount = test.unmount; }; afterEach(function () { // if unmount defined, call it to clear up any mounted component unmount && unmount(); }); it('IdeAPIKeyGeneration tolerates no props being provided, and renders with defaults', function () { mountTestComponent(); expect(component.getElements()).toMatchSnapshot(); }); });