@khanacademy/wonder-blocks-testing 6.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/es/index.js +19 -191
  3. package/dist/index.js +87 -462
  4. package/package.json +2 -2
  5. package/src/__docs__/_overview_fixtures.stories.mdx +2 -6
  6. package/src/__docs__/exports.fixtures.stories.mdx +9 -31
  7. package/src/__docs__/types.fixture-fn.stories.mdx +46 -0
  8. package/src/__docs__/types.fixture-props.stories.mdx +20 -0
  9. package/src/__docs__/types.get-props-options.stories.mdx +28 -1
  10. package/src/fixtures/__tests__/fixtures.test.js +75 -470
  11. package/src/fixtures/fixtures.basic.stories.js +30 -50
  12. package/src/fixtures/fixtures.defaultwrapper.stories.js +26 -40
  13. package/src/fixtures/fixtures.js +48 -103
  14. package/src/fixtures/types.js +19 -178
  15. package/src/index.js +2 -11
  16. package/src/__docs__/exports.fixture-adapters.stories.mdx +0 -49
  17. package/src/__docs__/exports.setup-fixtures.stories.mdx +0 -22
  18. package/src/__docs__/types.custom-mount-props.stories.mdx +0 -35
  19. package/src/__docs__/types.fixtures-adapter-factory.stories.mdx +0 -23
  20. package/src/__docs__/types.fixtures-adapter-fixture-options.stories.mdx +0 -35
  21. package/src/__docs__/types.fixtures-adapter-group-options.stories.mdx +0 -37
  22. package/src/__docs__/types.fixtures-adapter-group.stories.mdx +0 -43
  23. package/src/__docs__/types.fixtures-adapter-options.stories.mdx +0 -21
  24. package/src/__docs__/types.fixtures-adapter.stories.mdx +0 -35
  25. package/src/__docs__/types.fixtures-configuration.stories.mdx +0 -35
  26. package/src/__docs__/types.fixtures-options.stories.mdx +0 -51
  27. package/src/fixtures/__tests__/combine-options.test.js +0 -65
  28. package/src/fixtures/__tests__/combine-top-level.test.js +0 -100
  29. package/src/fixtures/__tests__/setup.test.js +0 -71
  30. package/src/fixtures/adapters/__tests__/__snapshots__/adapter-group.test.js.snap +0 -9
  31. package/src/fixtures/adapters/__tests__/__snapshots__/adapter.test.js.snap +0 -13
  32. package/src/fixtures/adapters/__tests__/adapter-group.test.js +0 -223
  33. package/src/fixtures/adapters/__tests__/adapter.test.js +0 -97
  34. package/src/fixtures/adapters/__tests__/storybook.test.js +0 -329
  35. package/src/fixtures/adapters/adapter-group.js +0 -88
  36. package/src/fixtures/adapters/adapter.js +0 -63
  37. package/src/fixtures/adapters/adapters.js +0 -2
  38. package/src/fixtures/adapters/storybook.js +0 -125
  39. package/src/fixtures/combine-options.js +0 -25
  40. package/src/fixtures/combine-top-level.js +0 -44
  41. package/src/fixtures/setup.js +0 -30
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 31);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 23);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ([
@@ -148,7 +148,7 @@ module.exports = require("react-router-dom");
148
148
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return makeTestHarness; });
149
149
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
150
150
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
151
- /* harmony import */ var _render_adapters_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30);
151
+ /* harmony import */ var _render_adapters_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
152
152
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
153
153
 
154
154
 
@@ -202,40 +202,10 @@ const makeTestHarness = (adapters, defaultConfigs) => {
202
202
  /* 4 */
203
203
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
204
204
 
205
- "use strict";
206
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setup; });
207
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getConfiguration; });
208
- let _configuration = null;
209
- /**
210
- * Setup the fixture framework.
211
- */
212
-
213
- const setup = configuration => {
214
- _configuration = configuration;
215
- };
216
- /**
217
- * Get the framework configuration.
218
- *
219
- * @returns {Configuration} The configuration as provided via setup().
220
- * @throws {Error} If the configuration has not been set.
221
- */
222
-
223
- const getConfiguration = () => {
224
- if (_configuration == null) {
225
- throw new Error("Not configured");
226
- }
227
-
228
- return _configuration;
229
- };
230
-
231
- /***/ }),
232
- /* 5 */
233
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
234
-
235
205
  "use strict";
236
206
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RespondWith; });
237
207
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return makeMockResponse; });
238
- /* harmony import */ var _response_impl_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
208
+ /* harmony import */ var _response_impl_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
239
209
 
240
210
 
241
211
  /**
@@ -349,7 +319,7 @@ const makeMockResponse = response => {
349
319
  };
350
320
 
351
321
  /***/ }),
352
- /* 6 */
322
+ /* 5 */
353
323
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
354
324
 
355
325
  "use strict";
@@ -392,12 +362,12 @@ const makeHookHarness = (adapters, defaultConfigs) => {
392
362
  };
393
363
 
394
364
  /***/ }),
395
- /* 7 */
365
+ /* 6 */
396
366
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
397
367
 
398
368
  "use strict";
399
369
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mockRequester; });
400
- /* harmony import */ var _make_mock_response_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
370
+ /* harmony import */ var _make_mock_response_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
401
371
 
402
372
 
403
373
  /**
@@ -449,6 +419,12 @@ const mockRequester = (operationMatcher, operationToString) => {
449
419
  return mockFn;
450
420
  };
451
421
 
422
+ /***/ }),
423
+ /* 7 */
424
+ /***/ (function(module, exports) {
425
+
426
+ module.exports = require("@storybook/addon-actions");
427
+
452
428
  /***/ }),
453
429
  /* 8 */
454
430
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -522,7 +498,7 @@ const adapter = (children, config) => {
522
498
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return adapter; });
523
499
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
524
500
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
525
- /* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
501
+ /* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
526
502
  /* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__);
527
503
 
528
504
 
@@ -707,211 +683,81 @@ const adapter = (children, config) => {
707
683
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
708
684
 
709
685
  "use strict";
710
- __webpack_require__.r(__webpack_exports__);
711
- /* harmony import */ var _storybook_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
712
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "storybook", function() { return _storybook_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
713
-
714
-
715
-
716
- /***/ }),
717
- /* 13 */
718
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
719
-
720
- "use strict";
721
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getAdapter; });
686
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fixtures; });
722
687
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
723
688
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
724
- /* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
689
+ /* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
725
690
  /* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__);
726
- /* harmony import */ var _adapter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
727
-
728
691
 
729
692
 
730
693
 
731
694
  /**
732
- * Get a fixture framework adapter for Storybook support.
695
+ * Describe a group of fixtures for a given component.
696
+ *
697
+ * Only one `fixtures` call should be used per fixture file as it returns
698
+ * the exports for that file.
699
+ *
700
+ * @param {component: React.ComponentType<any>} options Options describing the
701
+ * fixture group.
702
+ * @param {FixtureFn<TProps> => void} fn A function that provides a `fixture`
703
+ * function for defining fixtures.
704
+ * @returns {(
705
+ * description: string,
706
+ * props: FixtureProps<TProps>,
707
+ * wrapper?: React.ComponentType<TProps>,
708
+ * ) => mixed} A function to create a CSF compatible story.
733
709
  */
734
- const getAdapter = (MountingComponent = null) => new _adapter_js__WEBPACK_IMPORTED_MODULE_2__[/* Adapter */ "a"]("storybook", ({
735
- title,
736
- description: groupDescription,
737
- // We don't use the default title in Storybook as storybook
738
- // will generate titles for us if we pass a nullish title.
739
- getDefaultTitle: _
740
- }, adapterOptions, declaredFixtures) => {
741
- const templateMap = new WeakMap();
742
-
743
- const log = (message, ...args) => Object(_storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__["action"])(message).apply(void 0, args);
744
-
745
- const exports = declaredFixtures.reduce((acc, {
746
- description,
747
- getProps,
748
- component: Component
749
- }, i) => {
750
- const storyName = `${i + 1} ${description}`;
751
- const exportName = storyName // Make word boundaries start with an upper case letter.
752
- .replace(/\b\w/g, c => c.toUpperCase()) // Remove all non-alphanumeric characters.
753
- .replace(/[^\w]+/g, "") // Remove all underscores.
754
- .replace(/[_]+/g, ""); // We create a “template” of how args map to rendering
710
+ const fixtures = Component => {
711
+ const templateMap = new WeakMap(); // We use this to make sure each story gets a unique name.
712
+
713
+ let storyNumber = 1;
714
+ const getPropsOptions = {
715
+ log: (message, ...args) => Object(_storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__["action"])(message).apply(void 0, args),
716
+ logHandler: _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__["action"]
717
+ };
718
+
719
+ const makeStory = (description, props, wrapper = null) => {
720
+ const storyName = `${storyNumber++} ${description}`;
721
+
722
+ const getProps = options => typeof props === "function" ? props(options) : props; // We create a “template” of how args map to rendering
755
723
  // for each type of component as the component here could
756
724
  // be the component under test, or wrapped in a wrapper
757
725
  // component. We don't use decorators for the wrapper
758
726
  // because we may not be in a storybook context and it
759
727
  // keeps the framework API simpler this way.
760
728
 
729
+
761
730
  let Template = templateMap.get(Component);
762
731
 
763
732
  if (Template == null) {
764
- // The MountingComponent is a bit different than just a
765
- // Storybook decorator. It's a React component that
766
- // takes over rendering the component in the fixture
767
- // with the given args, allowing for greater
768
- // customization in a platform-agnostic manner (i.e.
769
- // not just story format).
770
- Template = MountingComponent ? args => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](MountingComponent, {
771
- component: Component,
772
- props: args,
773
- log: log
774
- }) : args => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](Component, args);
733
+ Template = args => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](Component, args);
734
+
775
735
  templateMap.set(Component, Template);
776
736
  } // Each story that shares that component then reuses that
777
737
  // template.
778
738
 
779
739
 
780
- acc[exportName] = Template.bind({});
781
- acc[exportName].args = getProps({
782
- log
783
- }); // Adding a story name here means that we don't have to
740
+ const story = Template.bind({});
741
+ story.args = getProps(getPropsOptions); // Adding a story name here means that we don't have to
784
742
  // care about naming the exports correctly, if we don't
785
743
  // want (useful if we need to autogenerate or manually
786
744
  // expose ESM exports).
787
745
 
788
- acc[exportName].storyName = storyName;
789
- return acc;
790
- }, {
791
- default: {
792
- title,
793
- // TODO(somewhatabstract): Use groupDescription
794
- // Possibly via a decorator?
795
- ...adapterOptions
796
- }
797
- });
798
- return Object.freeze(exports);
799
- });
800
-
801
- /***/ }),
802
- /* 14 */
803
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
804
-
805
- "use strict";
806
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fixtures; });
807
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
808
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
809
- /* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
810
- /* harmony import */ var _combine_options_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23);
811
-
812
-
813
-
814
-
815
- const normalizeOptions = componentOrOptions => {
816
- // To differentiate between a React component and a FixturesOptions object,
817
- // we have to do some type checking.
818
- //
819
- // Alternatives I considered were:
820
- // - Use an additional parameter for the options and then do an arg number
821
- // check, but that always makes typing a function harder and often breaks
822
- // types. I didn't want that battle today.
823
- // - Use a tuple when providing component and options with the first element
824
- // being the component and the second being the options. However that
825
- // feels like an obscure API even though it's really easy to do the
826
- // typing.
827
- if ( // Most React components, whether functional or class-based, are
828
- // inherently functions in JavaScript, so a check for functions is
829
- // usually sufficient.
830
- typeof componentOrOptions === "function" || // However, the return of React.forwardRef is not a function,
831
- // so we also have to cope with that.
832
- // A forwardRef has $$typeof = Symbol(react.forward_ref) and a
833
- // render function.
834
- // $FlowIgnore[prop-missing]
835
- typeof componentOrOptions.render === "function") {
836
- return {
837
- // $FlowIgnore[incompatible-return]
838
- component: componentOrOptions
839
- };
840
- } // We can't test for React.ComponentType at runtime.
841
- // Let's assume our simple heuristic above is sufficient.
842
- // $FlowIgnore[incompatible-return]
843
-
844
-
845
- return componentOrOptions;
846
- };
847
- /**
848
- * Describe a group of fixtures for a given component.
849
- *
850
- * Only one `fixtures` call should be used per fixture file as it returns
851
- * the exports for that file.
852
- *
853
- * @param {FixtureOptions<TProps>} options Options describing the
854
- * fixture group.
855
- * @param {FixtureFn<TProps> => void} fn A function that provides a `fixture`
856
- * function for defining fixtures.
857
- * @returns {Exports} The object to be exported as `module.exports`.
858
- *
859
- * TODO(somewhatabstract): Determine a way around this requirement so we
860
- * can support named exports and default exports via the adapters in a
861
- * deterministic way. Currently this is imposed on us because of how
862
- * storybook, the popular framework, uses both default and named exports for
863
- * its interface.
864
- */
865
-
866
-
867
- const fixtures = (componentOrOptions, fn) => {
868
- var _additionalAdapterOpt;
869
-
870
- const {
871
- adapter,
872
- defaultAdapterOptions
873
- } = Object(_setup_js__WEBPACK_IMPORTED_MODULE_1__[/* getConfiguration */ "a"])();
874
- const {
875
- title,
876
- component,
877
- description: groupDescription,
878
- defaultWrapper,
879
- additionalAdapterOptions
880
- } = normalizeOptions(componentOrOptions); // 1. Create a new adapter group.
881
-
882
- const group = adapter.declareGroup({
883
- title,
884
- description: groupDescription,
885
- getDefaultTitle: () => component.displayName || component.name || "Component"
886
- }); // 2. Invoke fn with a function that can add a new fixture.
887
-
888
- const addFixture = (description, props, wrapper = null) => {
889
- var _ref;
890
-
891
- group.declareFixture({
892
- description,
893
- getProps: options => typeof props === "function" ? props(options) : props,
894
- component: (_ref = wrapper != null ? wrapper : defaultWrapper) != null ? _ref : component
895
- });
746
+ story.storyName = storyName;
747
+ return story;
896
748
  };
897
749
 
898
- fn(addFixture); // 3. Combine the adapter options from the fixture group with the
899
- // defaults from our setup.
900
-
901
- const groupAdapterOverrides = (_additionalAdapterOpt = additionalAdapterOptions == null ? void 0 : additionalAdapterOptions[adapter.name]) != null ? _additionalAdapterOpt : {};
902
- const combinedAdapterOptions = Object(_combine_options_js__WEBPACK_IMPORTED_MODULE_2__[/* combineOptions */ "a"])(defaultAdapterOptions, groupAdapterOverrides); // 4. Call close on the group and return the result.
903
-
904
- return group.closeGroup(combinedAdapterOptions);
750
+ return makeStory;
905
751
  };
906
752
 
907
753
  /***/ }),
908
- /* 15 */
754
+ /* 13 */
909
755
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
910
756
 
911
757
  "use strict";
912
758
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mockFetch; });
913
- /* harmony import */ var _fetch_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
914
- /* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
759
+ /* harmony import */ var _fetch_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18);
760
+ /* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
915
761
 
916
762
 
917
763
 
@@ -922,13 +768,13 @@ const mockFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1__[/
922
768
  Options: ${init == null ? "None" : JSON.stringify(init, null, 2)}`);
923
769
 
924
770
  /***/ }),
925
- /* 16 */
771
+ /* 14 */
926
772
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
927
773
 
928
774
  "use strict";
929
775
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mockGqlFetch; });
930
- /* harmony import */ var _gql_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28);
931
- /* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
776
+ /* harmony import */ var _gql_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
777
+ /* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
932
778
 
933
779
 
934
780
 
@@ -940,7 +786,7 @@ const mockGqlFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1_
940
786
  Context: ${JSON.stringify(context, null, 2)}`);
941
787
 
942
788
  /***/ }),
943
- /* 17 */
789
+ /* 15 */
944
790
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
945
791
 
946
792
  "use strict";
@@ -952,14 +798,14 @@ const mockGqlFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1_
952
798
  */
953
799
 
954
800
  /***/ }),
955
- /* 18 */
801
+ /* 16 */
956
802
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
957
803
 
958
804
  "use strict";
959
805
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hookHarness; });
960
806
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
961
807
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
962
- /* harmony import */ var _make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
808
+ /* harmony import */ var _make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
963
809
  /* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
964
810
 
965
811
 
@@ -977,7 +823,7 @@ const mockGqlFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1_
977
823
  const hookHarness = Object(_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__[/* makeHookHarness */ "a"])(_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__["DefaultAdapters"], _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__["DefaultConfigs"]);
978
824
 
979
825
  /***/ }),
980
- /* 19 */
826
+ /* 17 */
981
827
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
982
828
 
983
829
  "use strict";
@@ -1002,220 +848,7 @@ const hookHarness = Object(_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__[/*
1002
848
  const testHarness = Object(_make_test_harness_js__WEBPACK_IMPORTED_MODULE_1__[/* makeTestHarness */ "a"])(_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__["DefaultAdapters"], _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__["DefaultConfigs"]);
1003
849
 
1004
850
  /***/ }),
1005
- /* 20 */
1006
- /***/ (function(module, exports) {
1007
-
1008
- module.exports = require("@storybook/addon-actions");
1009
-
1010
- /***/ }),
1011
- /* 21 */
1012
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1013
-
1014
- "use strict";
1015
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Adapter; });
1016
- /* harmony import */ var _adapter_group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
1017
-
1018
-
1019
- /**
1020
- * Class for implementing a custom adapter.
1021
- */
1022
- class Adapter {
1023
- /**
1024
- * @param {string} name The name of the adapter.
1025
- * @param {CloseGroupFn<any, Options, Exports>} closeGroupFn The function
1026
- * an adapter group should call when the group is closed. This is invoked
1027
- * by an adapter group when it is closed. This function is where an
1028
- * adapter implements the logic to generate the actual fixtures for the
1029
- * adapter's target framework.
1030
- */
1031
- constructor(name, closeGroupFn) {
1032
- if (typeof name !== "string") {
1033
- throw new TypeError("name must be a string");
1034
- }
1035
-
1036
- if (name.trim() === "") {
1037
- throw new Error("name must be a non-empty string");
1038
- }
1039
-
1040
- if (typeof closeGroupFn !== "function") {
1041
- throw new TypeError("closeGroupFn must be a function");
1042
- }
1043
-
1044
- this._name = name;
1045
- this._closeGroupFn = closeGroupFn;
1046
- }
1047
- /**
1048
- * The name of the adapter.
1049
- */
1050
-
1051
-
1052
- get name() {
1053
- return this._name;
1054
- }
1055
- /**
1056
- * Declare a new fixture group.
1057
- *
1058
- * @param {FixturesAdapterGroupOptions} options The options describing the fixture
1059
- * group.
1060
- * @returns {FixturesAdapterGroup} The new fixture group.
1061
- */
1062
-
1063
-
1064
- declareGroup(options) {
1065
- return new _adapter_group_js__WEBPACK_IMPORTED_MODULE_0__[/* AdapterGroup */ "a"](this._closeGroupFn, options);
1066
- }
1067
-
1068
- }
1069
-
1070
- /***/ }),
1071
- /* 22 */
1072
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1073
-
1074
- "use strict";
1075
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AdapterGroup; });
1076
- /**
1077
- * Simple adapter group implementation.
1078
- */
1079
- class AdapterGroup {
1080
- /**
1081
- * Create an adapter group.
1082
- *
1083
- * @param {CloseGroupFn<TProps, Options, Exports>} closeGroupFn A function
1084
- * to invoke when the group is closed.
1085
- * @param {AdapterGroupOptions} options The options for the group.
1086
- */
1087
- constructor(closeGroupFn, _options) {
1088
- this.closeGroup = (adapterOptions = null) => {
1089
- if (this._closeGroupFn == null) {
1090
- throw new Error("Group already closed");
1091
- }
1092
-
1093
- try {
1094
- return this._closeGroupFn(this._options, adapterOptions, this._fixtures);
1095
- } finally {
1096
- this._closeGroupFn = null;
1097
- }
1098
- };
1099
-
1100
- this.declareFixture = options => {
1101
- if (typeof options !== "object" || options === null) {
1102
- throw new TypeError("options must be an object");
1103
- }
1104
-
1105
- if (this._closeGroupFn == null) {
1106
- throw new Error("Cannot declare fixtures after closing the group");
1107
- }
1108
-
1109
- this._fixtures.push(options);
1110
- };
1111
-
1112
- if (typeof closeGroupFn !== "function") {
1113
- throw new TypeError("closeGroupFn must be a function");
1114
- }
1115
-
1116
- if (typeof _options !== "object" || _options === null) {
1117
- throw new TypeError("options must be an object");
1118
- }
1119
-
1120
- this._closeGroupFn = closeGroupFn;
1121
- this._options = _options;
1122
- this._fixtures = [];
1123
- }
1124
- /**
1125
- * Close the group.
1126
- *
1127
- * This declares that no more fixtures are to be added to the group,
1128
- * and will call the parent adapter with the declared fixtures so that they
1129
- * can be adapted for the target fixture framework, such as Storybook.
1130
- */
1131
-
1132
-
1133
- }
1134
-
1135
- /***/ }),
1136
- /* 23 */
1137
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1138
-
1139
- "use strict";
1140
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return combineOptions; });
1141
- /* harmony import */ var _combine_top_level_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
1142
-
1143
- /**
1144
- * Combine one or more objects into a single object.
1145
- *
1146
- * Objects later in the argument list take precedence over those that are
1147
- * earlier. Object and array values at the root level are merged.
1148
- */
1149
-
1150
- const combineOptions = (...toBeCombined) => {
1151
- const combined = toBeCombined.filter(Boolean).reduce((acc, cur) => {
1152
- for (const key of Object.keys(cur)) {
1153
- // We always call combine, even if acc[key] is undefined
1154
- // because we need to make sure we clone values.
1155
- acc[key] = Object(_combine_top_level_js__WEBPACK_IMPORTED_MODULE_0__[/* combineTopLevel */ "a"])(acc[key], cur[key]);
1156
- }
1157
-
1158
- return acc;
1159
- }, {}); // We know that we are creating a compatible return type.
1160
- // $FlowIgnore[incompatible-return]
1161
-
1162
- return combined;
1163
- };
1164
-
1165
- /***/ }),
1166
- /* 24 */
1167
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1168
-
1169
- "use strict";
1170
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return combineTopLevel; });
1171
- /* harmony import */ var _khanacademy_wonder_stuff_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
1172
- /* harmony import */ var _khanacademy_wonder_stuff_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_stuff_core__WEBPACK_IMPORTED_MODULE_0__);
1173
-
1174
- /**
1175
- * Combine two values.
1176
- *
1177
- * This method clones val2 before using any of its properties to try to ensure
1178
- * the combined object is not linked back to the original.
1179
- *
1180
- * If the values are objects, it will merge them at the top level. Properties
1181
- * themselves are not merged; val2 properties will overwrite val1 where there
1182
- * are conflicts
1183
- *
1184
- * If the values are arrays, it will concatenate and dedupe them.
1185
- * NOTE: duplicates in either val1 or val2 will also be deduped.
1186
- *
1187
- * If the values are any other type, or val2 has a different type to val1, val2
1188
- * will be returned.
1189
- */
1190
-
1191
- const combineTopLevel = (val1, val2) => {
1192
- const obj2Clone = Object(_khanacademy_wonder_stuff_core__WEBPACK_IMPORTED_MODULE_0__["clone"])(val2); // Only merge if they're both arrays or both objects.
1193
- // If not, we will just return val2.
1194
-
1195
- if (val1 !== null && val2 !== null && typeof val1 === "object" && typeof val2 === "object") {
1196
- const val1IsArray = Array.isArray(val1);
1197
- const val2IsArray = Array.isArray(val2);
1198
-
1199
- if (val1IsArray && val2IsArray) {
1200
- return Array.from(new Set([].concat(val1, obj2Clone)));
1201
- } else if (!val1IsArray && !val2IsArray) {
1202
- return { ...val1,
1203
- ...obj2Clone
1204
- };
1205
- }
1206
- }
1207
-
1208
- return obj2Clone;
1209
- };
1210
-
1211
- /***/ }),
1212
- /* 25 */
1213
- /***/ (function(module, exports) {
1214
-
1215
- module.exports = require("@khanacademy/wonder-stuff-core");
1216
-
1217
- /***/ }),
1218
- /* 26 */
851
+ /* 18 */
1219
852
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1220
853
 
1221
854
  "use strict";
@@ -1258,7 +891,7 @@ const fetchRequestMatchesMock = (mock, input, init) => {
1258
891
  };
1259
892
 
1260
893
  /***/ }),
1261
- /* 27 */
894
+ /* 19 */
1262
895
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1263
896
 
1264
897
  "use strict";
@@ -1268,10 +901,10 @@ const fetchRequestMatchesMock = (mock, input, init) => {
1268
901
  // --experimental-fetch flag), then we're good, but otherwise we need an
1269
902
  // implementation, so this uses node-fetch as a peer dependency and uses that
1270
903
  // to provide the implementation if we don't already have one.
1271
- const ResponseImpl = typeof Response === "undefined" ? __webpack_require__(32).Response : Response;
904
+ const ResponseImpl = typeof Response === "undefined" ? __webpack_require__(24).Response : Response;
1272
905
 
1273
906
  /***/ }),
1274
- /* 28 */
907
+ /* 20 */
1275
908
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1276
909
 
1277
910
  "use strict";
@@ -1346,13 +979,13 @@ const gqlRequestMatchesMock = (mock, operation, variables, context) => {
1346
979
  };
1347
980
 
1348
981
  /***/ }),
1349
- /* 29 */
982
+ /* 21 */
1350
983
  /***/ (function(module, exports) {
1351
984
 
1352
985
  module.exports = require("@khanacademy/wonder-blocks-data");
1353
986
 
1354
987
  /***/ }),
1355
- /* 30 */
988
+ /* 22 */
1356
989
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1357
990
 
1358
991
  "use strict";
@@ -1384,48 +1017,40 @@ const renderAdapters = (adapters, configs, children) => {
1384
1017
  };
1385
1018
 
1386
1019
  /***/ }),
1387
- /* 31 */
1020
+ /* 23 */
1388
1021
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1389
1022
 
1390
1023
  "use strict";
1391
1024
  __webpack_require__.r(__webpack_exports__);
1392
- /* harmony import */ var _fixtures_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
1393
- /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "fixtureAdapters", function() { return _fixtures_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_0__; });
1394
- /* harmony import */ var _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
1395
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fixtures", function() { return _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
1396
-
1397
- /* harmony import */ var _fixtures_setup_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
1398
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setupFixtures", function() { return _fixtures_setup_js__WEBPACK_IMPORTED_MODULE_2__["b"]; });
1025
+ /* harmony import */ var _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
1026
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fixtures", function() { return _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
1399
1027
 
1400
- /* harmony import */ var _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15);
1401
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockFetch", function() { return _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_3__["a"]; });
1028
+ /* harmony import */ var _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13);
1029
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockFetch", function() { return _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
1402
1030
 
1403
- /* harmony import */ var _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16);
1404
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockGqlFetch", function() { return _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_4__["a"]; });
1031
+ /* harmony import */ var _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
1032
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockGqlFetch", function() { return _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_2__["a"]; });
1405
1033
 
1406
- /* harmony import */ var _make_mock_response_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
1407
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RespondWith", function() { return _make_mock_response_js__WEBPACK_IMPORTED_MODULE_5__["a"]; });
1034
+ /* harmony import */ var _make_mock_response_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
1035
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RespondWith", function() { return _make_mock_response_js__WEBPACK_IMPORTED_MODULE_3__["a"]; });
1408
1036
 
1409
- /* harmony import */ var _harness_types_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17);
1410
- /* harmony import */ var _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
1411
- /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "harnessAdapters", function() { return _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_7__; });
1412
- /* harmony import */ var _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6);
1413
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeHookHarness", function() { return _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_8__["a"]; });
1037
+ /* harmony import */ var _harness_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15);
1038
+ /* harmony import */ var _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1);
1039
+ /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "harnessAdapters", function() { return _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_5__; });
1040
+ /* harmony import */ var _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5);
1041
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeHookHarness", function() { return _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_6__["a"]; });
1414
1042
 
1415
- /* harmony import */ var _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3);
1416
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeTestHarness", function() { return _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_9__["a"]; });
1043
+ /* harmony import */ var _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3);
1044
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeTestHarness", function() { return _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_7__["a"]; });
1417
1045
 
1418
- /* harmony import */ var _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(18);
1419
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hookHarness", function() { return _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_10__["a"]; });
1046
+ /* harmony import */ var _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(16);
1047
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hookHarness", function() { return _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_8__["a"]; });
1420
1048
 
1421
- /* harmony import */ var _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(19);
1422
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "testHarness", function() { return _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_11__["a"]; });
1049
+ /* harmony import */ var _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17);
1050
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "testHarness", function() { return _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_9__["a"]; });
1423
1051
 
1424
1052
  // Fixtures framework
1425
1053
 
1426
-
1427
-
1428
-
1429
1054
  // Fetch mocking framework
1430
1055
 
1431
1056
 
@@ -1440,7 +1065,7 @@ __webpack_require__.r(__webpack_exports__);
1440
1065
 
1441
1066
 
1442
1067
  /***/ }),
1443
- /* 32 */
1068
+ /* 24 */
1444
1069
  /***/ (function(module, exports) {
1445
1070
 
1446
1071
  module.exports = require("node-fetch");