"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _react = require("@testing-library/react");
var _react2 = _interopRequireDefault(require("react"));
var _testUtils = require("../../test-utils");
var _testkit = require("@wix/fe-essentials-standalone/testkit");
var _internal = require("@wix/bex-core/testkit/internal");
var _usePickerContent = require("./usePickerContent");
var _usePickerModal = require("../usePickerModal");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/hooks/usePickerContent/usePickerContent.spec.tsx";
describe('usePickerContent', () => {
  _testkit.testkit.beforeAndAfter();
  let driver;
  beforeEach(() => {
    driver = new _internal.WixPatternsContainerDriver();
  });
  it('allows optional options', () => {
    const App = () => {
      const modalState = (0, _usePickerModal.usePickerModal)({
        queryName: 'usePickerModal-test',
        biLoggerFactory: driver.biLoggerFactory,
        environment: driver.environment,
        errorMonitor: driver.errorMonitor,
        fetchData: async () => ({
          items: []
        }),
        pickerContentComponent: async () => ({
          default: () => /*#__PURE__*/_react2.default.createElement("div", {
            __self: void 0,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 33,
              columnNumber: 63
            }
          })
        }),
        onSelect: jest.fn()
      });
      (0, _usePickerContent.usePickerContent)({
        modalState,
        fetchErrorMessage: () => null
      });
      return null;
    };
    (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_testUtils.CairoTestApp, {
      driver: driver,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 45,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react2.default.createElement(App, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 46,
        columnNumber: 9
      }
    })));
  });
  it('expects errors when required options are missing', () => {
    const App = () => {
      const modalState = (0, _usePickerModal.usePickerModal)({
        queryName: 'usePickerModal-test',
        biLoggerFactory: driver.biLoggerFactory,
        environment: driver.environment,
        errorMonitor: driver.errorMonitor,
        fetchData: async () => ({
          items: []
        }),
        filters: {
          level: {
            initialValue: ['Ultimate']
          }
        },
        pickerContentComponent: async () => ({
          default: () => /*#__PURE__*/_react2.default.createElement("div", {
            __self: void 0,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 64,
              columnNumber: 63
            }
          })
        }),
        onSelect: jest.fn()
      });
      (0, _usePickerContent.usePickerContent)(
      // @ts-expect-error
      {
        modalState,
        fetchErrorMessage: () => null
      });
      return null;
    };
    (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_testUtils.CairoTestApp, {
      driver: driver,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 79,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react2.default.createElement(App, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 80,
        columnNumber: 9
      }
    })));
  });
});
//# sourceMappingURL=usePickerContent.spec.js.map