@khanacademy/wonder-blocks-testing 7.1.1 → 7.1.2
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.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +130 -79
- package/package.json +2 -2
- package/src/__tests__/mock-requester.test.js +3 -3
- package/src/__tests__/respond-with.test.js +1 -1
- package/src/fetch/__tests__/__snapshots__/mock-fetch.test.js.snap +8 -8
- package/src/fetch/__tests__/fetch-request-matches-mock.test.js +1 -1
- package/src/gql/__tests__/mock-gql-fetch.test.js +9 -9
package/CHANGELOG.md
CHANGED
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 =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 28);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -93,16 +93,30 @@ module.exports = require("react");
|
|
|
93
93
|
|
|
94
94
|
/***/ }),
|
|
95
95
|
/* 1 */
|
|
96
|
+
/***/ (function(module, exports) {
|
|
97
|
+
|
|
98
|
+
function _classPrivateFieldBase(receiver, privateKey) {
|
|
99
|
+
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
100
|
+
throw new TypeError("attempted to use private field on non-instance");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return receiver;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
107
|
+
|
|
108
|
+
/***/ }),
|
|
109
|
+
/* 2 */
|
|
96
110
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
97
111
|
|
|
98
112
|
"use strict";
|
|
99
113
|
__webpack_require__.r(__webpack_exports__);
|
|
100
114
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultAdapters", function() { return DefaultAdapters; });
|
|
101
115
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultConfigs", function() { return DefaultConfigs; });
|
|
102
|
-
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
103
|
-
/* harmony import */ var _data_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
104
|
-
/* harmony import */ var _portal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
105
|
-
/* harmony import */ var _router_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
116
|
+
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
117
|
+
/* harmony import */ var _data_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
|
|
118
|
+
/* harmony import */ var _portal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
|
|
119
|
+
/* harmony import */ var _router_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
|
|
106
120
|
|
|
107
121
|
|
|
108
122
|
|
|
@@ -135,21 +149,22 @@ const DefaultConfigs = {
|
|
|
135
149
|
};
|
|
136
150
|
|
|
137
151
|
/***/ }),
|
|
138
|
-
/*
|
|
152
|
+
/* 3 */
|
|
139
153
|
/***/ (function(module, exports) {
|
|
140
154
|
|
|
141
155
|
module.exports = require("react-router-dom");
|
|
142
156
|
|
|
143
157
|
/***/ }),
|
|
144
|
-
/*
|
|
158
|
+
/* 4 */
|
|
145
159
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
146
160
|
|
|
147
161
|
"use strict";
|
|
148
162
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return makeTestHarness; });
|
|
149
|
-
/* harmony import */ var
|
|
150
|
-
/* harmony import */ var
|
|
151
|
-
/* harmony import */ var
|
|
152
|
-
|
|
163
|
+
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
|
|
164
|
+
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
|
|
165
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
166
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
167
|
+
/* harmony import */ var _render_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27);
|
|
153
168
|
|
|
154
169
|
|
|
155
170
|
|
|
@@ -188,7 +203,7 @@ const makeTestHarness = (adapters, defaultConfigs) => {
|
|
|
188
203
|
const fullConfig = { ...defaultConfigs,
|
|
189
204
|
...configs
|
|
190
205
|
};
|
|
191
|
-
const harnessedComponent = /*#__PURE__*/
|
|
206
|
+
const harnessedComponent = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["forwardRef"]((props, ref) => Object(_render_adapters_js__WEBPACK_IMPORTED_MODULE_2__[/* renderAdapters */ "a"])(adapters, fullConfig, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](Component, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {
|
|
192
207
|
ref: ref
|
|
193
208
|
})))); // We add a name for the component here so that we can detect that
|
|
194
209
|
// later and also see it in traces and what have you.
|
|
@@ -199,14 +214,26 @@ const makeTestHarness = (adapters, defaultConfigs) => {
|
|
|
199
214
|
};
|
|
200
215
|
|
|
201
216
|
/***/ }),
|
|
202
|
-
/*
|
|
217
|
+
/* 5 */
|
|
218
|
+
/***/ (function(module, exports) {
|
|
219
|
+
|
|
220
|
+
var id = 0;
|
|
221
|
+
|
|
222
|
+
function _classPrivateFieldKey(name) {
|
|
223
|
+
return "__private_" + id++ + "_" + name;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
227
|
+
|
|
228
|
+
/***/ }),
|
|
229
|
+
/* 6 */
|
|
203
230
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
204
231
|
|
|
205
232
|
"use strict";
|
|
206
233
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return makeHookHarness; });
|
|
207
234
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
208
235
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
209
|
-
/* harmony import */ var _make_test_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
236
|
+
/* harmony import */ var _make_test_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
210
237
|
|
|
211
238
|
|
|
212
239
|
|
|
@@ -242,7 +269,7 @@ const makeHookHarness = (adapters, defaultConfigs) => {
|
|
|
242
269
|
};
|
|
243
270
|
|
|
244
271
|
/***/ }),
|
|
245
|
-
/*
|
|
272
|
+
/* 7 */
|
|
246
273
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
247
274
|
|
|
248
275
|
"use strict";
|
|
@@ -297,18 +324,19 @@ const mockRequester = (operationMatcher, operationToString) => {
|
|
|
297
324
|
};
|
|
298
325
|
|
|
299
326
|
/***/ }),
|
|
300
|
-
/*
|
|
327
|
+
/* 8 */
|
|
301
328
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
302
329
|
|
|
303
330
|
"use strict";
|
|
304
331
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SettleSignal; });
|
|
305
|
-
|
|
332
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
333
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0__);
|
|
334
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
|
335
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1__);
|
|
306
336
|
|
|
307
|
-
var id = 0;
|
|
308
337
|
|
|
309
|
-
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
|
|
310
338
|
|
|
311
|
-
var _settled = /*#__PURE__*/
|
|
339
|
+
var _settled = /*#__PURE__*/_babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1___default()("settled");
|
|
312
340
|
|
|
313
341
|
/**
|
|
314
342
|
* A signal for controlling the `RespondWith` API responses.
|
|
@@ -327,11 +355,11 @@ class SettleSignal extends EventTarget {
|
|
|
327
355
|
value: false
|
|
328
356
|
});
|
|
329
357
|
setSettleFn == null ? void 0 : setSettleFn(() => {
|
|
330
|
-
if (
|
|
358
|
+
if (_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _settled)[_settled]) {
|
|
331
359
|
throw new Error("SettleSignal already settled");
|
|
332
360
|
}
|
|
333
361
|
|
|
334
|
-
|
|
362
|
+
_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _settled)[_settled] = true;
|
|
335
363
|
this.dispatchEvent(new Event("settled"));
|
|
336
364
|
});
|
|
337
365
|
}
|
|
@@ -342,7 +370,7 @@ class SettleSignal extends EventTarget {
|
|
|
342
370
|
|
|
343
371
|
static settle() {
|
|
344
372
|
const signal = new SettleSignal();
|
|
345
|
-
|
|
373
|
+
_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(signal, _settled)[_settled] = true;
|
|
346
374
|
return signal;
|
|
347
375
|
}
|
|
348
376
|
/**
|
|
@@ -351,19 +379,19 @@ class SettleSignal extends EventTarget {
|
|
|
351
379
|
|
|
352
380
|
|
|
353
381
|
get settled() {
|
|
354
|
-
return
|
|
382
|
+
return _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _settled)[_settled];
|
|
355
383
|
}
|
|
356
384
|
|
|
357
385
|
}
|
|
358
386
|
|
|
359
387
|
/***/ }),
|
|
360
|
-
/*
|
|
388
|
+
/* 9 */
|
|
361
389
|
/***/ (function(module, exports) {
|
|
362
390
|
|
|
363
391
|
module.exports = require("@storybook/addon-actions");
|
|
364
392
|
|
|
365
393
|
/***/ }),
|
|
366
|
-
/*
|
|
394
|
+
/* 10 */
|
|
367
395
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
368
396
|
|
|
369
397
|
"use strict";
|
|
@@ -427,7 +455,7 @@ const adapter = (children, config) => {
|
|
|
427
455
|
};
|
|
428
456
|
|
|
429
457
|
/***/ }),
|
|
430
|
-
/*
|
|
458
|
+
/* 11 */
|
|
431
459
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
432
460
|
|
|
433
461
|
"use strict";
|
|
@@ -435,7 +463,7 @@ const adapter = (children, config) => {
|
|
|
435
463
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return adapter; });
|
|
436
464
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
437
465
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
438
|
-
/* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
466
|
+
/* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25);
|
|
439
467
|
/* harmony import */ var _khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_data__WEBPACK_IMPORTED_MODULE_1__);
|
|
440
468
|
|
|
441
469
|
|
|
@@ -473,7 +501,7 @@ const adapter = (children, config) => {
|
|
|
473
501
|
};
|
|
474
502
|
|
|
475
503
|
/***/ }),
|
|
476
|
-
/*
|
|
504
|
+
/* 12 */
|
|
477
505
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
478
506
|
|
|
479
507
|
"use strict";
|
|
@@ -498,7 +526,7 @@ const adapter = (children, config) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODUL
|
|
|
498
526
|
}), children);
|
|
499
527
|
|
|
500
528
|
/***/ }),
|
|
501
|
-
/*
|
|
529
|
+
/* 13 */
|
|
502
530
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
503
531
|
|
|
504
532
|
"use strict";
|
|
@@ -506,7 +534,7 @@ const adapter = (children, config) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODUL
|
|
|
506
534
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return adapter; });
|
|
507
535
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
508
536
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
509
|
-
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
537
|
+
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
510
538
|
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_1__);
|
|
511
539
|
|
|
512
540
|
|
|
@@ -616,14 +644,14 @@ const adapter = (children, config) => {
|
|
|
616
644
|
};
|
|
617
645
|
|
|
618
646
|
/***/ }),
|
|
619
|
-
/*
|
|
647
|
+
/* 14 */
|
|
620
648
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
621
649
|
|
|
622
650
|
"use strict";
|
|
623
651
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fixtures; });
|
|
624
652
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
625
653
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
626
|
-
/* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
654
|
+
/* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
627
655
|
/* harmony import */ var _storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_storybook_addon_actions__WEBPACK_IMPORTED_MODULE_1__);
|
|
628
656
|
|
|
629
657
|
|
|
@@ -689,13 +717,13 @@ const fixtures = Component => {
|
|
|
689
717
|
};
|
|
690
718
|
|
|
691
719
|
/***/ }),
|
|
692
|
-
/*
|
|
720
|
+
/* 15 */
|
|
693
721
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
694
722
|
|
|
695
723
|
"use strict";
|
|
696
724
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mockFetch; });
|
|
697
|
-
/* harmony import */ var _fetch_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
698
|
-
/* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
725
|
+
/* harmony import */ var _fetch_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
|
|
726
|
+
/* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
|
699
727
|
|
|
700
728
|
|
|
701
729
|
|
|
@@ -706,13 +734,13 @@ const mockFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1__[/
|
|
|
706
734
|
Options: ${init == null ? "None" : JSON.stringify(init, null, 2)}`);
|
|
707
735
|
|
|
708
736
|
/***/ }),
|
|
709
|
-
/*
|
|
737
|
+
/* 16 */
|
|
710
738
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
711
739
|
|
|
712
740
|
"use strict";
|
|
713
741
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return mockGqlFetch; });
|
|
714
|
-
/* harmony import */ var _gql_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
715
|
-
/* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
742
|
+
/* harmony import */ var _gql_request_matches_mock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
|
|
743
|
+
/* harmony import */ var _mock_requester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
|
|
716
744
|
|
|
717
745
|
|
|
718
746
|
|
|
@@ -724,13 +752,13 @@ const mockGqlFetch = () => Object(_mock_requester_js__WEBPACK_IMPORTED_MODULE_1_
|
|
|
724
752
|
Context: ${JSON.stringify(context, null, 2)}`);
|
|
725
753
|
|
|
726
754
|
/***/ }),
|
|
727
|
-
/*
|
|
755
|
+
/* 17 */
|
|
728
756
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
729
757
|
|
|
730
758
|
"use strict";
|
|
731
759
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RespondWith; });
|
|
732
|
-
/* harmony import */ var _settle_signal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
733
|
-
/* harmony import */ var _response_impl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
760
|
+
/* harmony import */ var _settle_signal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
761
|
+
/* harmony import */ var _response_impl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(24);
|
|
734
762
|
|
|
735
763
|
|
|
736
764
|
|
|
@@ -884,26 +912,26 @@ const makeMockResponse = response => {
|
|
|
884
912
|
};
|
|
885
913
|
|
|
886
914
|
/***/ }),
|
|
887
|
-
/*
|
|
915
|
+
/* 18 */
|
|
888
916
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
889
917
|
|
|
890
918
|
"use strict";
|
|
891
919
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SettleController; });
|
|
892
|
-
/* harmony import */ var
|
|
893
|
-
|
|
920
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
921
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0__);
|
|
922
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
|
923
|
+
/* harmony import */ var _babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1__);
|
|
924
|
+
/* harmony import */ var _settle_signal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
|
|
894
925
|
|
|
895
|
-
var id = 0;
|
|
896
|
-
|
|
897
|
-
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
|
|
898
926
|
|
|
899
927
|
|
|
900
928
|
/**
|
|
901
929
|
* A controller for the `RespondWith` API to control response settlement.
|
|
902
930
|
*/
|
|
903
931
|
|
|
904
|
-
var _settleFn = /*#__PURE__*/
|
|
932
|
+
var _settleFn = /*#__PURE__*/_babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1___default()("settleFn");
|
|
905
933
|
|
|
906
|
-
var _signal = /*#__PURE__*/
|
|
934
|
+
var _signal = /*#__PURE__*/_babel_runtime_helpers_classPrivateFieldLooseKey__WEBPACK_IMPORTED_MODULE_1___default()("signal");
|
|
907
935
|
|
|
908
936
|
class SettleController {
|
|
909
937
|
constructor() {
|
|
@@ -918,7 +946,7 @@ class SettleController {
|
|
|
918
946
|
// Create our signal.
|
|
919
947
|
// We pass in a method to capture it's settle function so that
|
|
920
948
|
// only we can call it.
|
|
921
|
-
|
|
949
|
+
_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _signal)[_signal] = new _settle_signal_js__WEBPACK_IMPORTED_MODULE_2__[/* SettleSignal */ "a"](settleFn => _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _settleFn)[_settleFn] = settleFn);
|
|
922
950
|
}
|
|
923
951
|
/**
|
|
924
952
|
* The signal to pass to the `RespondWith` API.
|
|
@@ -926,7 +954,7 @@ class SettleController {
|
|
|
926
954
|
|
|
927
955
|
|
|
928
956
|
get signal() {
|
|
929
|
-
return
|
|
957
|
+
return _babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _signal)[_signal];
|
|
930
958
|
}
|
|
931
959
|
/**
|
|
932
960
|
* Settle the signal and therefore any associated responses.
|
|
@@ -936,13 +964,13 @@ class SettleController {
|
|
|
936
964
|
|
|
937
965
|
|
|
938
966
|
settle() {
|
|
939
|
-
|
|
967
|
+
_babel_runtime_helpers_classPrivateFieldLooseBase__WEBPACK_IMPORTED_MODULE_0___default()(this, _settleFn)[_settleFn]();
|
|
940
968
|
}
|
|
941
969
|
|
|
942
970
|
}
|
|
943
971
|
|
|
944
972
|
/***/ }),
|
|
945
|
-
/*
|
|
973
|
+
/* 19 */
|
|
946
974
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
947
975
|
|
|
948
976
|
"use strict";
|
|
@@ -954,15 +982,15 @@ class SettleController {
|
|
|
954
982
|
*/
|
|
955
983
|
|
|
956
984
|
/***/ }),
|
|
957
|
-
/*
|
|
985
|
+
/* 20 */
|
|
958
986
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
959
987
|
|
|
960
988
|
"use strict";
|
|
961
989
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hookHarness; });
|
|
962
990
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
963
991
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
964
|
-
/* harmony import */ var _make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
965
|
-
/* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
992
|
+
/* harmony import */ var _make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
|
993
|
+
/* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
966
994
|
|
|
967
995
|
|
|
968
996
|
|
|
@@ -979,15 +1007,15 @@ class SettleController {
|
|
|
979
1007
|
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"]);
|
|
980
1008
|
|
|
981
1009
|
/***/ }),
|
|
982
|
-
/*
|
|
1010
|
+
/* 21 */
|
|
983
1011
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
984
1012
|
|
|
985
1013
|
"use strict";
|
|
986
1014
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return testHarness; });
|
|
987
1015
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
988
1016
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
989
|
-
/* harmony import */ var _make_test_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
990
|
-
/* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
1017
|
+
/* harmony import */ var _make_test_harness_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
1018
|
+
/* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
991
1019
|
|
|
992
1020
|
|
|
993
1021
|
|
|
@@ -1004,7 +1032,7 @@ const hookHarness = Object(_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_1__[/*
|
|
|
1004
1032
|
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"]);
|
|
1005
1033
|
|
|
1006
1034
|
/***/ }),
|
|
1007
|
-
/*
|
|
1035
|
+
/* 22 */
|
|
1008
1036
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1009
1037
|
|
|
1010
1038
|
"use strict";
|
|
@@ -1047,7 +1075,7 @@ const fetchRequestMatchesMock = (mock, input, init) => {
|
|
|
1047
1075
|
};
|
|
1048
1076
|
|
|
1049
1077
|
/***/ }),
|
|
1050
|
-
/*
|
|
1078
|
+
/* 23 */
|
|
1051
1079
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1052
1080
|
|
|
1053
1081
|
"use strict";
|
|
@@ -1122,7 +1150,7 @@ const gqlRequestMatchesMock = (mock, operation, variables, context) => {
|
|
|
1122
1150
|
};
|
|
1123
1151
|
|
|
1124
1152
|
/***/ }),
|
|
1125
|
-
/*
|
|
1153
|
+
/* 24 */
|
|
1126
1154
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1127
1155
|
|
|
1128
1156
|
"use strict";
|
|
@@ -1132,16 +1160,39 @@ const gqlRequestMatchesMock = (mock, operation, variables, context) => {
|
|
|
1132
1160
|
// --experimental-fetch flag), then we're good, but otherwise we need an
|
|
1133
1161
|
// implementation, so this uses node-fetch as a peer dependency and uses that
|
|
1134
1162
|
// to provide the implementation if we don't already have one.
|
|
1135
|
-
const ResponseImpl = typeof Response === "undefined" ? __webpack_require__(
|
|
1163
|
+
const ResponseImpl = typeof Response === "undefined" ? __webpack_require__(29).Response : Response;
|
|
1136
1164
|
|
|
1137
1165
|
/***/ }),
|
|
1138
|
-
/*
|
|
1166
|
+
/* 25 */
|
|
1139
1167
|
/***/ (function(module, exports) {
|
|
1140
1168
|
|
|
1141
1169
|
module.exports = require("@khanacademy/wonder-blocks-data");
|
|
1142
1170
|
|
|
1143
1171
|
/***/ }),
|
|
1144
|
-
/*
|
|
1172
|
+
/* 26 */
|
|
1173
|
+
/***/ (function(module, exports) {
|
|
1174
|
+
|
|
1175
|
+
function _extends() {
|
|
1176
|
+
module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1177
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1178
|
+
var source = arguments[i];
|
|
1179
|
+
|
|
1180
|
+
for (var key in source) {
|
|
1181
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1182
|
+
target[key] = source[key];
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
return target;
|
|
1188
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
1189
|
+
return _extends.apply(this, arguments);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
1193
|
+
|
|
1194
|
+
/***/ }),
|
|
1195
|
+
/* 27 */
|
|
1145
1196
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1146
1197
|
|
|
1147
1198
|
"use strict";
|
|
@@ -1173,39 +1224,39 @@ const renderAdapters = (adapters, configs, children) => {
|
|
|
1173
1224
|
};
|
|
1174
1225
|
|
|
1175
1226
|
/***/ }),
|
|
1176
|
-
/*
|
|
1227
|
+
/* 28 */
|
|
1177
1228
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1178
1229
|
|
|
1179
1230
|
"use strict";
|
|
1180
1231
|
__webpack_require__.r(__webpack_exports__);
|
|
1181
|
-
/* harmony import */ var _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
1232
|
+
/* harmony import */ var _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
|
1182
1233
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fixtures", function() { return _fixtures_fixtures_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
|
|
1183
1234
|
|
|
1184
|
-
/* harmony import */ var _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
1235
|
+
/* harmony import */ var _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
|
|
1185
1236
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockFetch", function() { return _fetch_mock_fetch_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
|
|
1186
1237
|
|
|
1187
|
-
/* harmony import */ var _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
1238
|
+
/* harmony import */ var _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
|
|
1188
1239
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mockGqlFetch", function() { return _gql_mock_gql_fetch_js__WEBPACK_IMPORTED_MODULE_2__["a"]; });
|
|
1189
1240
|
|
|
1190
|
-
/* harmony import */ var _respond_with_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
1241
|
+
/* harmony import */ var _respond_with_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17);
|
|
1191
1242
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RespondWith", function() { return _respond_with_js__WEBPACK_IMPORTED_MODULE_3__["a"]; });
|
|
1192
1243
|
|
|
1193
|
-
/* harmony import */ var _settle_controller_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
1244
|
+
/* harmony import */ var _settle_controller_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18);
|
|
1194
1245
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SettleController", function() { return _settle_controller_js__WEBPACK_IMPORTED_MODULE_4__["a"]; });
|
|
1195
1246
|
|
|
1196
|
-
/* harmony import */ var _harness_types_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
1197
|
-
/* harmony import */ var _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
1247
|
+
/* harmony import */ var _harness_types_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(19);
|
|
1248
|
+
/* harmony import */ var _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
|
|
1198
1249
|
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "harnessAdapters", function() { return _harness_adapters_adapters_js__WEBPACK_IMPORTED_MODULE_6__; });
|
|
1199
|
-
/* harmony import */ var _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
1250
|
+
/* harmony import */ var _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6);
|
|
1200
1251
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeHookHarness", function() { return _harness_make_hook_harness_js__WEBPACK_IMPORTED_MODULE_7__["a"]; });
|
|
1201
1252
|
|
|
1202
|
-
/* harmony import */ var _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
1253
|
+
/* harmony import */ var _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4);
|
|
1203
1254
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeTestHarness", function() { return _harness_make_test_harness_js__WEBPACK_IMPORTED_MODULE_8__["a"]; });
|
|
1204
1255
|
|
|
1205
|
-
/* harmony import */ var _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
|
|
1256
|
+
/* harmony import */ var _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(20);
|
|
1206
1257
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hookHarness", function() { return _harness_hook_harness_js__WEBPACK_IMPORTED_MODULE_9__["a"]; });
|
|
1207
1258
|
|
|
1208
|
-
/* harmony import */ var _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
|
|
1259
|
+
/* harmony import */ var _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(21);
|
|
1209
1260
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "testHarness", function() { return _harness_test_harness_js__WEBPACK_IMPORTED_MODULE_10__["a"]; });
|
|
1210
1261
|
|
|
1211
1262
|
// Fixtures framework
|
|
@@ -1225,7 +1276,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1225
1276
|
|
|
1226
1277
|
|
|
1227
1278
|
/***/ }),
|
|
1228
|
-
/*
|
|
1279
|
+
/* 29 */
|
|
1229
1280
|
/***/ (function(module, exports) {
|
|
1230
1281
|
|
|
1231
1282
|
module.exports = require("node-fetch");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-testing",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@khanacademy/wonder-blocks-data": "^9.1.
|
|
17
|
+
"@khanacademy/wonder-blocks-data": "^9.1.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@khanacademy/wonder-stuff-core": "^0.1.2",
|
|
@@ -48,9 +48,9 @@ describe("#mockRequester", () => {
|
|
|
48
48
|
|
|
49
49
|
// Assert
|
|
50
50
|
await expect(underTest).rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
"No matching mock response found for request:
|
|
52
|
+
TEST FORMATTING: ["any","arguments",{"we":{"want":42}}]"
|
|
53
|
+
`);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
describe("mockOperation", () => {
|
|
@@ -8,22 +8,22 @@ exports[`#mockFetch should reject with a useful error when there are no matching
|
|
|
8
8
|
|
|
9
9
|
exports[`#mockFetch should reject with a useful error when there are no matching mocks for %s 2`] = `
|
|
10
10
|
"No matching mock response found for request:
|
|
11
|
-
Input:
|
|
11
|
+
Input: "http://example.com/foo"
|
|
12
12
|
Options: {
|
|
13
|
-
|
|
13
|
+
"method": "GET"
|
|
14
14
|
}"
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
17
|
exports[`#mockFetch should reject with a useful error when there are no matching mocks for %s 3`] = `
|
|
18
18
|
"No matching mock response found for request:
|
|
19
19
|
Input: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
"size": 0,
|
|
21
|
+
"timeout": 0,
|
|
22
|
+
"follow": 20,
|
|
23
|
+
"compress": true,
|
|
24
|
+
"counter": 0
|
|
25
25
|
}
|
|
26
26
|
Options: {
|
|
27
|
-
|
|
27
|
+
"method": "POST"
|
|
28
28
|
}"
|
|
29
29
|
`;
|
|
@@ -20,7 +20,7 @@ describe("#fetchRequestMatchesMock", () => {
|
|
|
20
20
|
|
|
21
21
|
// Assert
|
|
22
22
|
expect(underTest).toThrowErrorMatchingInlineSnapshot(
|
|
23
|
-
`"Unsupported mock operation: {
|
|
23
|
+
`"Unsupported mock operation: {"operation":{"id":"foo","type":"query"}}"`,
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -174,15 +174,15 @@ describe("#mockGqlFetch", () => {
|
|
|
174
174
|
|
|
175
175
|
// Assert
|
|
176
176
|
await expect(result).rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
"No matching mock response found for request:
|
|
178
|
+
Operation: query getMyStuff
|
|
179
|
+
Variables: {
|
|
180
|
+
"a": "variable"
|
|
181
|
+
}
|
|
182
|
+
Context: {
|
|
183
|
+
"my": "context"
|
|
184
|
+
}"
|
|
185
|
+
`);
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
describe("mockOperation", () => {
|