@mic-rexjs/usecases-react 3.7.0 → 4.0.0-beta.3

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 (150) hide show
  1. package/dist/index.min.js +1 -1
  2. package/dist/index.min.js.LICENSE.txt +2 -0
  3. package/es/components/UseCaseFragment/index.js +2 -2
  4. package/es/enums/Statuses/index.d.ts +86 -10
  5. package/es/enums/Statuses/index.js +86 -10
  6. package/es/hooks/useAlternateStatuses/index.d.ts +2 -0
  7. package/es/hooks/useAlternateStatuses/index.js +16 -0
  8. package/es/hooks/useChanged/index.d.ts +2 -0
  9. package/es/hooks/useChanged/index.js +17 -0
  10. package/es/hooks/useChanged/types.d.ts +3 -0
  11. package/es/hooks/useContext/index.d.ts +3 -4
  12. package/es/hooks/useContext/index.js +17 -15
  13. package/es/hooks/useContext/index.test.js +13 -24
  14. package/es/hooks/useContextValue/index.d.ts +5 -0
  15. package/es/hooks/useContextValue/index.js +13 -0
  16. package/es/hooks/useDepsKey/index.js +11 -9
  17. package/es/hooks/useEntity/index.d.ts +3 -2
  18. package/es/hooks/useEntity/index.js +52 -53
  19. package/es/hooks/useEntityReturn/index.d.ts +5 -0
  20. package/es/hooks/useEntityReturn/index.js +15 -0
  21. package/es/hooks/useEntityReturn/types.d.ts +7 -0
  22. package/es/hooks/useEntityRootExec/index.d.ts +5 -0
  23. package/es/hooks/useEntityRootExec/index.js +7 -0
  24. package/es/hooks/useEntityRootExec/types.d.ts +7 -0
  25. package/es/hooks/useEntityRootExec/types.js +1 -0
  26. package/es/hooks/useEntityRootReturn/index.d.ts +5 -0
  27. package/es/hooks/useEntityRootReturn/index.js +14 -0
  28. package/es/hooks/useEntityRootReturn/types.d.ts +7 -0
  29. package/es/hooks/useEntityRootReturn/types.js +1 -0
  30. package/es/hooks/useExec/index.d.ts +2 -3
  31. package/es/hooks/useExec/index.js +3 -12
  32. package/es/hooks/useExec/types.d.ts +10 -2
  33. package/es/hooks/useFullArguments/index.d.ts +2 -3
  34. package/es/hooks/useFullArguments/index.js +4 -6
  35. package/es/hooks/useFullArguments/types.d.ts +2 -2
  36. package/es/hooks/useIfExec/index.d.ts +2 -0
  37. package/es/hooks/useIfExec/index.js +20 -0
  38. package/es/hooks/useIfExec/types.d.ts +6 -0
  39. package/es/hooks/useIfExec/types.js +1 -0
  40. package/es/hooks/useIfReturn/index.d.ts +2 -0
  41. package/es/hooks/useIfReturn/index.js +22 -0
  42. package/es/hooks/useIfReturn/types.d.ts +6 -0
  43. package/es/hooks/useIfReturn/types.js +1 -0
  44. package/es/hooks/useProvider/index.d.ts +3 -5
  45. package/es/hooks/useProvider/index.js +17 -23
  46. package/es/hooks/useProviders/index.js +4 -4
  47. package/es/hooks/useReducers/index.d.ts +5 -4
  48. package/es/hooks/useReducers/index.js +45 -27
  49. package/es/hooks/useReturn/index.d.ts +2 -0
  50. package/es/hooks/useReturn/index.js +33 -0
  51. package/es/hooks/useReturn/types.d.ts +11 -0
  52. package/es/hooks/useReturn/types.js +1 -0
  53. package/es/hooks/useRootInitializing/index.d.ts +2 -0
  54. package/es/hooks/useRootInitializing/index.js +14 -0
  55. package/es/hooks/useRootReturn/index.d.ts +5 -0
  56. package/es/hooks/useRootReturn/index.js +22 -0
  57. package/es/hooks/useRootReturn/types.d.ts +14 -0
  58. package/es/hooks/useRootReturn/types.js +1 -0
  59. package/es/hooks/useStatuses/index.d.ts +4 -4
  60. package/es/hooks/useStatuses/index.js +46 -21
  61. package/es/hooks/useStore/index.d.ts +3 -3
  62. package/es/hooks/useStore/index.js +21 -49
  63. package/es/hooks/useThrottleUpdate/index.d.ts +2 -0
  64. package/es/hooks/useThrottleUpdate/index.js +31 -0
  65. package/es/hooks/useThrottleUpdate/types.d.ts +3 -0
  66. package/es/hooks/useThrottleUpdate/types.js +1 -0
  67. package/es/hooks/useUseCase/index.js +21 -24
  68. package/es/hooks/useUseCase/index.test.js +330 -98
  69. package/es/hooks/useUseCase/types.d.ts +15 -5
  70. package/es/methods/cacheCall/index.d.ts +2 -0
  71. package/es/methods/cacheCall/index.js +38 -0
  72. package/es/methods/cacheCall/types.d.ts +12 -0
  73. package/es/methods/cacheCall/types.js +1 -0
  74. package/es/methods/cacheCalls/index.d.ts +2 -0
  75. package/es/methods/cacheCalls/index.js +12 -0
  76. package/es/types.d.ts +2 -1
  77. package/es/usecases/contextUseCase/index.js +21 -38
  78. package/es/usecases/contextUseCase/types.d.ts +5 -6
  79. package/es/usecases/lifecycleEventUseCase/index.js +37 -9
  80. package/es/usecases/lifecycleEventUseCase/types.d.ts +11 -8
  81. package/lib/components/UseCaseFragment/index.js +2 -2
  82. package/lib/enums/Statuses/index.js +86 -10
  83. package/lib/hooks/useAlternateStatuses/index.js +22 -0
  84. package/lib/hooks/useChanged/index.js +23 -0
  85. package/lib/hooks/useContext/index.js +19 -17
  86. package/lib/hooks/useContext/index.test.js +13 -24
  87. package/lib/hooks/useContextValue/index.js +19 -0
  88. package/lib/hooks/useDepsKey/index.js +10 -8
  89. package/lib/hooks/useEntity/index.js +81 -54
  90. package/lib/hooks/useEntityReturn/index.js +22 -0
  91. package/lib/hooks/useEntityRootExec/index.js +13 -0
  92. package/lib/hooks/useEntityRootExec/types.js +5 -0
  93. package/lib/hooks/useEntityRootReturn/index.js +21 -0
  94. package/lib/hooks/useEntityRootReturn/types.js +5 -0
  95. package/lib/hooks/useExec/index.js +3 -12
  96. package/lib/hooks/useFullArguments/index.js +4 -6
  97. package/lib/hooks/useIfExec/index.js +27 -0
  98. package/lib/hooks/useIfExec/types.js +5 -0
  99. package/lib/hooks/useIfReturn/index.js +29 -0
  100. package/lib/hooks/useIfReturn/types.js +5 -0
  101. package/lib/hooks/useProvider/index.js +16 -22
  102. package/lib/hooks/useProviders/index.js +3 -3
  103. package/lib/hooks/useReducers/index.js +46 -29
  104. package/lib/hooks/useReturn/index.js +40 -0
  105. package/lib/hooks/useReturn/types.js +5 -0
  106. package/lib/hooks/useRootInitializing/index.js +20 -0
  107. package/lib/hooks/useRootReturn/index.js +30 -0
  108. package/lib/hooks/useRootReturn/types.js +5 -0
  109. package/lib/hooks/useStatuses/index.js +47 -21
  110. package/lib/hooks/useStore/index.js +19 -48
  111. package/lib/hooks/useThrottleUpdate/index.js +37 -0
  112. package/lib/hooks/useThrottleUpdate/types.js +5 -0
  113. package/lib/hooks/useUseCase/index.js +22 -25
  114. package/lib/hooks/useUseCase/index.test.js +360 -97
  115. package/lib/methods/cacheCall/index.js +44 -0
  116. package/lib/methods/cacheCall/types.js +5 -0
  117. package/lib/methods/cacheCalls/index.js +19 -0
  118. package/lib/usecases/contextUseCase/index.js +21 -38
  119. package/lib/usecases/lifecycleEventUseCase/index.js +48 -8
  120. package/package.json +3 -3
  121. package/es/enums/ArgumentTypes/index.d.ts +0 -4
  122. package/es/enums/ArgumentTypes/index.js +0 -5
  123. package/es/hooks/useArgumentTypes/index.d.ts +0 -3
  124. package/es/hooks/useArgumentTypes/index.js +0 -14
  125. package/es/hooks/useConstantEntityReducers/index.d.ts +0 -3
  126. package/es/hooks/useConstantEntityReducers/index.js +0 -7
  127. package/es/hooks/useConstantFn/index.d.ts +0 -1
  128. package/es/hooks/useConstantFn/index.js +0 -10
  129. package/es/hooks/useConstantReducers/index.d.ts +0 -3
  130. package/es/hooks/useConstantReducers/index.js +0 -6
  131. package/es/hooks/useContextualItem/index.d.ts +0 -4
  132. package/es/hooks/useContextualItem/index.js +0 -31
  133. package/es/hooks/useContextualItem/types.d.ts +0 -3
  134. package/es/hooks/useEntityInitializing/index.d.ts +0 -2
  135. package/es/hooks/useEntityInitializing/index.js +0 -16
  136. package/es/usecases/methodUseCase/index.d.ts +0 -2
  137. package/es/usecases/methodUseCase/index.js +0 -72
  138. package/es/usecases/methodUseCase/types.d.ts +0 -21
  139. package/lib/enums/ArgumentTypes/index.js +0 -11
  140. package/lib/hooks/useArgumentTypes/index.js +0 -22
  141. package/lib/hooks/useConstantEntityReducers/index.js +0 -13
  142. package/lib/hooks/useConstantFn/index.js +0 -17
  143. package/lib/hooks/useConstantReducers/index.js +0 -12
  144. package/lib/hooks/useContextualItem/index.js +0 -37
  145. package/lib/hooks/useEntityInitializing/index.js +0 -22
  146. package/lib/usecases/methodUseCase/index.js +0 -79
  147. /package/es/hooks/{useContextualItem → useChanged}/types.js +0 -0
  148. /package/es/{usecases/methodUseCase → hooks/useEntityReturn}/types.js +0 -0
  149. /package/lib/hooks/{useContextualItem → useChanged}/types.js +0 -0
  150. /package/lib/{usecases/methodUseCase → hooks/useEntityReturn}/types.js +0 -0
@@ -40,6 +40,7 @@ var fileUseCase = function fileUseCase() {
40
40
  var entityReducers = (0, _usecases.entityUseCase)();
41
41
  var _options$pathPrefix = options.pathPrefix,
42
42
  pathPrefix = _options$pathPrefix === void 0 ? '' : _options$pathPrefix,
43
+ onReadFile = options.onReadFile,
43
44
  onPathChange = options.onPathChange;
44
45
  var init = function init(entity) {
45
46
  var newEntity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultFile;
@@ -80,11 +81,11 @@ var fileUseCase = function fileUseCase() {
80
81
  });
81
82
  var readFile = /*#__PURE__*/function () {
82
83
  var _ref8 = (0, _wrapAsyncGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(entity, path) {
83
- var size;
84
+ var _onReadFile, size;
84
85
  return _regenerator["default"].wrap(function (_context5) {
85
86
  while (1) switch (_context5.prev = _context5.next) {
86
87
  case 0:
87
- size = 2000;
88
+ size = (_onReadFile = onReadFile === null || onReadFile === void 0 ? void 0 : onReadFile(path)) !== null && _onReadFile !== void 0 ? _onReadFile : 2000;
88
89
  return _context5.delegateYield((0, _asyncGeneratorDelegate2["default"])(_asyncIterator(setPath(entity, path)), _awaitAsyncGenerator2["default"]), "t0", 1);
89
90
  case 1:
90
91
  _context5.next = 2;
@@ -1053,7 +1054,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
1053
1054
  _dom.fireEvent.click(_dom.screen.getByText(updateButtonText));
1054
1055
  (0, _globals.expect)(addReducer).toHaveBeenCalledTimes(3);
1055
1056
  });
1056
- (0, _globals.test)('`options.onChange` should be trigger when entity has changed', function () {
1057
+ (0, _globals.test)('`options.onChange` should be triggered when entity has changed', function () {
1057
1058
  var onChange = _globals.jest.fn();
1058
1059
  var _renderHook23 = (0, _react.renderHook)(function () {
1059
1060
  return (0, _.useUseCase)(defaultFile, fileUseCase, {
@@ -1263,7 +1264,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
1263
1264
  (0, _globals.expect)(onPathChange2).toHaveBeenCalledTimes(1);
1264
1265
  (0, _globals.expect)(onPathChange2).toHaveBeenLastCalledWith(PATH_2, PATH_1);
1265
1266
  });
1266
- (0, _globals.test)('`options.watch` should be trigger after entity changed', function () {
1267
+ (0, _globals.test)('`options.watch` should be triggered after entity changed', function () {
1267
1268
  var onPathChange = _globals.jest.fn();
1268
1269
  var onSizeChange = _globals.jest.fn();
1269
1270
  var _renderHook30 = (0, _react.renderHook)(function () {
@@ -1295,7 +1296,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
1295
1296
  oldValue: ''
1296
1297
  });
1297
1298
  });
1298
- (0, _globals.test)('`options.watch` should be trigger after update entity by entity initializer', function () {
1299
+ (0, _globals.test)('`options.watch` should be triggered after update entity by entity initializer', function () {
1299
1300
  var onPathChange = _globals.jest.fn();
1300
1301
  var _renderHook31 = (0, _react.renderHook)(function () {
1301
1302
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -1340,7 +1341,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
1340
1341
  oldValue: PATH_1
1341
1342
  });
1342
1343
  });
1343
- (0, _globals.test)('`options.watch` should be trigger after update entity by entity initializer at child component', function () {
1344
+ (0, _globals.test)('`options.watch` should be triggered after update entity by entity initializer at child component', function () {
1344
1345
  var onPathChange = _globals.jest.fn();
1345
1346
  var TestChild = function TestChild() {
1346
1347
  (0, _.useUseCase)(fileUseCase, {
@@ -2026,15 +2027,16 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2026
2027
  (0, _globals.expect)(onStringMount).toHaveBeenCalledWith('hello');
2027
2028
  (0, _globals.expect)(onBooleanMount).toHaveBeenCalledWith(true);
2028
2029
  });
2029
- (0, _globals.test)('`onBind` event should be called when component mount', function () {
2030
+ (0, _globals.test)('Lifecycle `onBind` event should be called when component mount', function () {
2030
2031
  var onBind = _globals.jest.fn(function (entity) {
2031
2032
  void entity;
2032
2033
  });
2033
2034
  var testUseCase = function testUseCase() {
2034
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2035
+ var entityReducers = (0, _usecases.entityUseCase)();
2036
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2035
2037
  onBind: onBind
2036
2038
  });
2037
- return _objectSpread({}, lifecycleReducers);
2039
+ return _objectSpread({}, entityReducers);
2038
2040
  };
2039
2041
  (0, _react.renderHook)(function () {
2040
2042
  var _useUseCase24 = (0, _.useUseCase)(5, testUseCase),
@@ -2047,16 +2049,17 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2047
2049
  (0, _globals.expect)(onBind).toHaveBeenCalledTimes(1);
2048
2050
  (0, _globals.expect)(onBind).toHaveBeenCalledWith(5);
2049
2051
  });
2050
- (0, _globals.test)('`onChange` event should be called when entity change', function () {
2052
+ (0, _globals.test)('Lifecycle `onChange` event should be called when entity change', function () {
2051
2053
  var onChange = _globals.jest.fn(function (newEntity, oldEntity) {
2052
2054
  void newEntity;
2053
2055
  void oldEntity;
2054
2056
  });
2055
2057
  var testUseCase = function testUseCase() {
2056
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2058
+ var entityReducers = (0, _usecases.entityUseCase)();
2059
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2057
2060
  onChange: onChange
2058
2061
  });
2059
- return _objectSpread({}, lifecycleReducers);
2062
+ return _objectSpread({}, entityReducers);
2060
2063
  };
2061
2064
  var _renderHook37 = (0, _react.renderHook)(function () {
2062
2065
  return (0, _.useUseCase)(5, testUseCase);
@@ -2072,24 +2075,211 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2072
2075
  (0, _globals.expect)(onChange).toHaveBeenCalledTimes(1);
2073
2076
  (0, _globals.expect)(onChange).toHaveBeenCalledWith(100, 5);
2074
2077
  });
2075
- (0, _globals.test)('`onUpdate` event should be called when entity change', function () {
2076
- var onUpdate = _globals.jest.fn(function (newEntity, oldEntity) {
2078
+ (0, _globals.test)('Lifecycle `onChange` event should support returning a boolean to control whether the component updates', function () {
2079
+ var i = 0;
2080
+ var onChange = _globals.jest.fn(function (newEntity, oldEntity) {
2077
2081
  void newEntity;
2078
2082
  void oldEntity;
2083
+ return i++ === 0;
2079
2084
  });
2085
+ var onRenderHook = _globals.jest.fn();
2080
2086
  var testUseCase = function testUseCase() {
2081
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2082
- onUpdate: onUpdate
2087
+ var entityReducers = (0, _usecases.entityUseCase)();
2088
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2089
+ onChange: onChange
2083
2090
  });
2084
- return _objectSpread({}, lifecycleReducers);
2091
+ return _objectSpread({}, entityReducers);
2085
2092
  };
2086
2093
  var _renderHook38 = (0, _react.renderHook)(function () {
2087
- return (0, _.useUseCase)(5, testUseCase);
2094
+ var core = (0, _.useUseCase)(5, testUseCase);
2095
+ var _core = (0, _slicedToArray2["default"])(core, 1),
2096
+ value = _core[0];
2097
+ onRenderHook(value);
2098
+ return core;
2088
2099
  }),
2089
2100
  result = _renderHook38.result;
2090
2101
  var current = result.current;
2091
2102
  var _current9 = (0, _slicedToArray2["default"])(current, 2),
2092
2103
  setEntity = _current9[1].setEntity;
2104
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2105
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(5);
2106
+ (0, _react.act)(function () {
2107
+ setEntity(100);
2108
+ });
2109
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2110
+ (0, _react.act)(function () {
2111
+ setEntity(200);
2112
+ });
2113
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(2);
2114
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(200);
2115
+ });
2116
+ (0, _globals.test)('Lifecycle `onChange` event should support returning a Promise<boolean> to control whether the component updates', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee12() {
2117
+ var i, promise, onChange, onRenderHook, testUseCase, _renderHook39, result, current, _current0, setEntity;
2118
+ return _regenerator["default"].wrap(function (_context15) {
2119
+ while (1) switch (_context15.prev = _context15.next) {
2120
+ case 0:
2121
+ i = 0;
2122
+ promise = null;
2123
+ onChange = _globals.jest.fn(function (newEntity, oldEntity) {
2124
+ void newEntity;
2125
+ void oldEntity;
2126
+ promise = new Promise(function (res) {
2127
+ setTimeout(function () {
2128
+ res(i++ === 0);
2129
+ }, 500);
2130
+ });
2131
+ return promise;
2132
+ });
2133
+ onRenderHook = _globals.jest.fn();
2134
+ testUseCase = function testUseCase() {
2135
+ var entityReducers = (0, _usecases.entityUseCase)();
2136
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2137
+ onChange: onChange
2138
+ });
2139
+ return _objectSpread({}, entityReducers);
2140
+ };
2141
+ _renderHook39 = (0, _react.renderHook)(function () {
2142
+ var core = (0, _.useUseCase)(5, testUseCase);
2143
+ var _core2 = (0, _slicedToArray2["default"])(core, 1),
2144
+ value = _core2[0];
2145
+ onRenderHook(value);
2146
+ return core;
2147
+ }), result = _renderHook39.result;
2148
+ current = result.current;
2149
+ _current0 = (0, _slicedToArray2["default"])(current, 2), setEntity = _current0[1].setEntity;
2150
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2151
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(5);
2152
+ (0, _react.act)(function () {
2153
+ setEntity(100);
2154
+ });
2155
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2156
+ _context15.next = 1;
2157
+ return (0, _react.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10() {
2158
+ return _regenerator["default"].wrap(function (_context13) {
2159
+ while (1) switch (_context13.prev = _context13.next) {
2160
+ case 0:
2161
+ _context13.next = 1;
2162
+ return Promise.resolve(promise);
2163
+ case 1:
2164
+ case "end":
2165
+ return _context13.stop();
2166
+ }
2167
+ }, _callee10);
2168
+ })));
2169
+ case 1:
2170
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2171
+ (0, _react.act)(function () {
2172
+ setEntity(200);
2173
+ });
2174
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2175
+ _context15.next = 2;
2176
+ return (0, _react.act)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee11() {
2177
+ return _regenerator["default"].wrap(function (_context14) {
2178
+ while (1) switch (_context14.prev = _context14.next) {
2179
+ case 0:
2180
+ _context14.next = 1;
2181
+ return Promise.resolve(promise);
2182
+ case 1:
2183
+ case "end":
2184
+ return _context14.stop();
2185
+ }
2186
+ }, _callee11);
2187
+ })));
2188
+ case 2:
2189
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(2);
2190
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(200);
2191
+ case 3:
2192
+ case "end":
2193
+ return _context15.stop();
2194
+ }
2195
+ }, _callee12);
2196
+ })));
2197
+ (0, _globals.test)('Lifecycle `onChange` event should support returning a number to control whether the component updates', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee13() {
2198
+ var onChange, onRenderHook, testUseCase, _renderHook40, result, current, _current1, setEntity;
2199
+ return _regenerator["default"].wrap(function (_context16) {
2200
+ while (1) switch (_context16.prev = _context16.next) {
2201
+ case 0:
2202
+ onChange = _globals.jest.fn(function (newEntity, oldEntity) {
2203
+ void newEntity;
2204
+ void oldEntity;
2205
+ return 500;
2206
+ });
2207
+ onRenderHook = _globals.jest.fn();
2208
+ testUseCase = function testUseCase() {
2209
+ var entityReducers = (0, _usecases.entityUseCase)();
2210
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2211
+ onChange: onChange
2212
+ });
2213
+ return _objectSpread({}, entityReducers);
2214
+ };
2215
+ _renderHook40 = (0, _react.renderHook)(function () {
2216
+ var core = (0, _.useUseCase)(5, testUseCase);
2217
+ var _core3 = (0, _slicedToArray2["default"])(core, 1),
2218
+ value = _core3[0];
2219
+ onRenderHook(value);
2220
+ return core;
2221
+ }), result = _renderHook40.result;
2222
+ current = result.current;
2223
+ _current1 = (0, _slicedToArray2["default"])(current, 2), setEntity = _current1[1].setEntity;
2224
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(1);
2225
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(5);
2226
+ (0, _react.act)(function () {
2227
+ setEntity(100);
2228
+ });
2229
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(2);
2230
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(100);
2231
+ _context16.next = 1;
2232
+ return (0, _react.act)(function () {
2233
+ return new Promise(function (res) {
2234
+ setEntity(200);
2235
+ setTimeout(res, 100);
2236
+ });
2237
+ });
2238
+ case 1:
2239
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(2);
2240
+ _context16.next = 2;
2241
+ return (0, _react.act)(function () {
2242
+ return new Promise(function (res) {
2243
+ setEntity(300);
2244
+ setTimeout(res, 100);
2245
+ });
2246
+ });
2247
+ case 2:
2248
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(2);
2249
+ _context16.next = 3;
2250
+ return (0, _react.act)(function () {
2251
+ return new Promise(function (res) {
2252
+ setTimeout(res, 500);
2253
+ });
2254
+ });
2255
+ case 3:
2256
+ (0, _globals.expect)(onRenderHook).toHaveBeenCalledTimes(3);
2257
+ (0, _globals.expect)(onRenderHook).toHaveBeenLastCalledWith(300);
2258
+ case 4:
2259
+ case "end":
2260
+ return _context16.stop();
2261
+ }
2262
+ }, _callee13);
2263
+ })));
2264
+ (0, _globals.test)('Lifecycle `onUpdate` event should be called when entity change', function () {
2265
+ var onUpdate = _globals.jest.fn(function (newEntity, oldEntity) {
2266
+ void newEntity;
2267
+ void oldEntity;
2268
+ });
2269
+ var testUseCase = function testUseCase() {
2270
+ var entityReducers = (0, _usecases.entityUseCase)();
2271
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2272
+ onUpdate: onUpdate
2273
+ });
2274
+ return _objectSpread({}, entityReducers);
2275
+ };
2276
+ var _renderHook41 = (0, _react.renderHook)(function () {
2277
+ return (0, _.useUseCase)(5, testUseCase);
2278
+ }),
2279
+ result = _renderHook41.result;
2280
+ var current = result.current;
2281
+ var _current10 = (0, _slicedToArray2["default"])(current, 2),
2282
+ setEntity = _current10[1].setEntity;
2093
2283
  (0, _globals.expect)(onUpdate).toHaveBeenCalledTimes(0);
2094
2284
  (0, _react.act)(function () {
2095
2285
  setEntity(100);
@@ -2097,17 +2287,18 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2097
2287
  (0, _globals.expect)(onUpdate).toHaveBeenCalledTimes(1);
2098
2288
  (0, _globals.expect)(onUpdate).toHaveBeenCalledWith(100, 5);
2099
2289
  });
2100
- (0, _globals.test)('`onUnbind` event should be called when component unmount', function () {
2290
+ (0, _globals.test)('Lifecycle `onUnbind` event should be called when component unmount', function () {
2101
2291
  var onUnbind = _globals.jest.fn(function (entity) {
2102
2292
  void entity;
2103
2293
  });
2104
2294
  var testUseCase = function testUseCase() {
2105
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2295
+ var entityReducers = (0, _usecases.entityUseCase)();
2296
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2106
2297
  onUnbind: onUnbind
2107
2298
  });
2108
- return _objectSpread({}, lifecycleReducers);
2299
+ return _objectSpread({}, entityReducers);
2109
2300
  };
2110
- var _renderHook39 = (0, _react.renderHook)(function () {
2301
+ var _renderHook42 = (0, _react.renderHook)(function () {
2111
2302
  var _useUseCase26 = (0, _.useUseCase)(5, testUseCase),
2112
2303
  _useUseCase27 = (0, _slicedToArray2["default"])(_useUseCase26, 2),
2113
2304
  setEntity = _useUseCase27[1].setEntity;
@@ -2115,66 +2306,138 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2115
2306
  setEntity(100);
2116
2307
  });
2117
2308
  }),
2118
- unmount = _renderHook39.unmount;
2309
+ unmount = _renderHook42.unmount;
2119
2310
  (0, _globals.expect)(onUnbind).toHaveBeenCalledTimes(0);
2120
2311
  unmount();
2121
2312
  (0, _globals.expect)(onUnbind).toHaveBeenCalledTimes(1);
2122
2313
  (0, _globals.expect)(onUnbind).toHaveBeenCalledWith(100);
2123
2314
  });
2124
- });
2125
- (0, _globals.test)('`onAdopt` event should be called when entity change', function () {
2126
- var onAdopt = _globals.jest.fn(function (newEntity, oldeEntity) {
2127
- void newEntity;
2128
- void oldeEntity;
2315
+ (0, _globals.test)('Lifecycle `onAdopt` event should be called when entity change', function () {
2316
+ var onAdopt = _globals.jest.fn(function (newEntity, oldeEntity) {
2317
+ void newEntity;
2318
+ void oldeEntity;
2319
+ });
2320
+ var testUseCase = function testUseCase() {
2321
+ var entityReducers = (0, _usecases.entityUseCase)();
2322
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2323
+ onAdopt: onAdopt
2324
+ });
2325
+ return _objectSpread({}, entityReducers);
2326
+ };
2327
+ var _renderHook43 = (0, _react.renderHook)(function () {
2328
+ return (0, _.useUseCase)(5, testUseCase);
2329
+ }),
2330
+ result = _renderHook43.result;
2331
+ var current = result.current;
2332
+ var _current11 = (0, _slicedToArray2["default"])(current, 2),
2333
+ setEntity = _current11[1].setEntity;
2334
+ (0, _globals.expect)(onAdopt).toHaveBeenCalledTimes(1);
2335
+ (0, _globals.expect)(onAdopt).toHaveBeenCalledWith(5);
2336
+ (0, _react.act)(function () {
2337
+ setEntity(100);
2338
+ });
2339
+ (0, _globals.expect)(onAdopt).toHaveBeenCalledTimes(2);
2340
+ (0, _globals.expect)(onAdopt).toHaveBeenCalledWith(100, 5);
2129
2341
  });
2130
- var testUseCase = function testUseCase() {
2131
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2132
- onAdopt: onAdopt
2342
+ (0, _globals.test)('Lifecycle `onDiscard` event should be called when component unmount', function () {
2343
+ var onDiscard = _globals.jest.fn(function (entity) {
2344
+ void entity;
2133
2345
  });
2134
- return _objectSpread({}, lifecycleReducers);
2135
- };
2136
- var _renderHook40 = (0, _react.renderHook)(function () {
2137
- return (0, _.useUseCase)(5, testUseCase);
2138
- }),
2139
- result = _renderHook40.result;
2140
- var current = result.current;
2141
- var _current0 = (0, _slicedToArray2["default"])(current, 2),
2142
- setEntity = _current0[1].setEntity;
2143
- (0, _globals.expect)(onAdopt).toHaveBeenCalledTimes(1);
2144
- (0, _globals.expect)(onAdopt).toHaveBeenCalledWith(5);
2145
- (0, _react.act)(function () {
2146
- setEntity(100);
2147
- });
2148
- (0, _globals.expect)(onAdopt).toHaveBeenCalledTimes(2);
2149
- (0, _globals.expect)(onAdopt).toHaveBeenCalledWith(100, 5);
2150
- });
2151
- (0, _globals.test)('`onDiscard` event should be called when component unmount', function () {
2152
- var onDiscard = _globals.jest.fn(function (entity) {
2153
- void entity;
2346
+ var testUseCase = function testUseCase() {
2347
+ var entityReducers = (0, _usecases.entityUseCase)();
2348
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2349
+ onDiscard: onDiscard
2350
+ });
2351
+ return _objectSpread({}, entityReducers);
2352
+ };
2353
+ var _renderHook44 = (0, _react.renderHook)(function () {
2354
+ return (0, _.useUseCase)(5, testUseCase);
2355
+ }),
2356
+ result = _renderHook44.result,
2357
+ unmount = _renderHook44.unmount;
2358
+ var current = result.current;
2359
+ var _current12 = (0, _slicedToArray2["default"])(current, 2),
2360
+ setEntity = _current12[1].setEntity;
2361
+ (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(0);
2362
+ (0, _react.act)(function () {
2363
+ setEntity(100);
2364
+ });
2365
+ (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(1);
2366
+ (0, _globals.expect)(onDiscard).toHaveBeenCalledWith(5);
2367
+ unmount();
2368
+ (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(2);
2369
+ (0, _globals.expect)(onDiscard).toHaveBeenCalledWith(100);
2154
2370
  });
2155
- var testUseCase = function testUseCase() {
2156
- var lifecycleReducers = (0, _lifecycleUseCase.lifecycleUseCase)({
2157
- onDiscard: onDiscard
2371
+ (0, _globals.test)('Should support call lifecycleUseCase at parent usecase and child usecase', function () {
2372
+ var onParentBind = _globals.jest.fn(function (entity) {
2373
+ void entity;
2158
2374
  });
2159
- return _objectSpread({}, lifecycleReducers);
2160
- };
2161
- var _renderHook41 = (0, _react.renderHook)(function () {
2162
- return (0, _.useUseCase)(5, testUseCase);
2163
- }),
2164
- result = _renderHook41.result,
2165
- unmount = _renderHook41.unmount;
2166
- var current = result.current;
2167
- var _current1 = (0, _slicedToArray2["default"])(current, 2),
2168
- setEntity = _current1[1].setEntity;
2169
- (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(0);
2170
- (0, _react.act)(function () {
2171
- setEntity(100);
2172
- });
2173
- (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(1);
2174
- (0, _globals.expect)(onDiscard).toHaveBeenCalledWith(5);
2175
- unmount();
2176
- (0, _globals.expect)(onDiscard).toHaveBeenCalledTimes(2);
2177
- (0, _globals.expect)(onDiscard).toHaveBeenCalledWith(100);
2375
+ var onParentChange = _globals.jest.fn(function (newEntity, oldEntity) {
2376
+ void newEntity;
2377
+ void oldEntity;
2378
+ });
2379
+ var onParentUnbind = _globals.jest.fn(function (entity) {
2380
+ void entity;
2381
+ });
2382
+ var onChildBind = _globals.jest.fn(function (entity) {
2383
+ void entity;
2384
+ });
2385
+ var onChildChange = _globals.jest.fn(function (newEntity, oldEntity) {
2386
+ void newEntity;
2387
+ void oldEntity;
2388
+ });
2389
+ var onChildUnbind = _globals.jest.fn(function (entity) {
2390
+ void entity;
2391
+ });
2392
+ var parentUseCase = function parentUseCase() {
2393
+ var entityReducers = (0, _usecases.entityUseCase)();
2394
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2395
+ onBind: onParentBind,
2396
+ onUnbind: onParentUnbind,
2397
+ onChange: onParentChange
2398
+ });
2399
+ return _objectSpread({}, entityReducers);
2400
+ };
2401
+ var childUseCase = function childUseCase() {
2402
+ var parentReducers = parentUseCase();
2403
+ (0, _lifecycleUseCase.lifecycleUseCase)({
2404
+ onBind: onChildBind,
2405
+ onUnbind: onChildUnbind,
2406
+ onChange: onChildChange
2407
+ });
2408
+ return _objectSpread({}, parentReducers);
2409
+ };
2410
+ var _renderHook45 = (0, _react.renderHook)(function () {
2411
+ return (0, _.useUseCase)(5, childUseCase);
2412
+ }),
2413
+ result = _renderHook45.result,
2414
+ unmount = _renderHook45.unmount;
2415
+ var current = result.current;
2416
+ var _current13 = (0, _slicedToArray2["default"])(current, 2),
2417
+ setEntity = _current13[1].setEntity;
2418
+ (0, _globals.expect)(onParentBind).toHaveBeenCalledTimes(1);
2419
+ (0, _globals.expect)(onParentBind).toHaveBeenCalledWith(5);
2420
+ (0, _globals.expect)(onParentChange).toHaveBeenCalledTimes(0);
2421
+ (0, _globals.expect)(onChildBind).toHaveBeenCalledTimes(1);
2422
+ (0, _globals.expect)(onChildBind).toHaveBeenCalledWith(5);
2423
+ (0, _globals.expect)(onChildChange).toHaveBeenCalledTimes(0);
2424
+ (0, _react.act)(function () {
2425
+ setEntity(100);
2426
+ });
2427
+ (0, _globals.expect)(onParentBind).toHaveBeenCalledTimes(1);
2428
+ (0, _globals.expect)(onParentChange).toHaveBeenCalledTimes(1);
2429
+ (0, _globals.expect)(onParentChange).toHaveBeenCalledWith(100, 5);
2430
+ (0, _globals.expect)(onChildBind).toHaveBeenCalledTimes(1);
2431
+ (0, _globals.expect)(onChildChange).toHaveBeenCalledTimes(1);
2432
+ (0, _globals.expect)(onChildChange).toHaveBeenCalledWith(100, 5);
2433
+ (0, _globals.expect)(onParentUnbind).toHaveBeenCalledTimes(0);
2434
+ (0, _globals.expect)(onChildUnbind).toHaveBeenCalledTimes(0);
2435
+ unmount();
2436
+ (0, _globals.expect)(onParentUnbind).toHaveBeenCalledTimes(1);
2437
+ (0, _globals.expect)(onParentUnbind).toHaveBeenCalledWith(100);
2438
+ (0, _globals.expect)(onChildUnbind).toHaveBeenCalledTimes(1);
2439
+ (0, _globals.expect)(onChildUnbind).toHaveBeenCalledWith(100);
2440
+ });
2178
2441
  });
2179
2442
  (0, _globals.describe)('`useUseCase` should work the same as `useContextualCoreCollection`', function () {
2180
2443
  (0, _globals.test)('Provider should be returned in child component', function () {
@@ -2182,9 +2445,9 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2182
2445
  var TestChild = function TestChild() {
2183
2446
  var core = (0, _.useUseCase)(fileUseCase);
2184
2447
  var length = core.length;
2185
- var _core = (0, _slicedToArray2["default"])(core, 3),
2186
- file = _core[0],
2187
- Provider = _core[2];
2448
+ var _core4 = (0, _slicedToArray2["default"])(core, 3),
2449
+ file = _core4[0],
2450
+ Provider = _core4[2];
2188
2451
  (0, _react2.useEffect)(function () {
2189
2452
  onCore(file, length, (0, _typeof2["default"])(Provider));
2190
2453
  });
@@ -2463,7 +2726,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2463
2726
  _dom.fireEvent.click(_dom.screen.getByText(updateButtonText));
2464
2727
  (0, _globals.expect)(addReducer).toHaveBeenCalledTimes(3);
2465
2728
  });
2466
- (0, _globals.test)('`options.onChange` event should be trigger in orders', function () {
2729
+ (0, _globals.test)('`options.onChange` event should be triggered in orders', function () {
2467
2730
  var changeTimes = 0;
2468
2731
  var updateChangeTimes = function updateChangeTimes() {
2469
2732
  return ++changeTimes;
@@ -2563,7 +2826,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2563
2826
  path: PATH_1
2564
2827
  }));
2565
2828
  });
2566
- (0, _globals.test)('`options.watch` should be trigger at child elements', function () {
2829
+ (0, _globals.test)('`options.watch` should be triggered at child components', function () {
2567
2830
  var onExtChange = _globals.jest.fn();
2568
2831
  var firstButtonText = 'first button';
2569
2832
  var A = function A() {
@@ -2605,7 +2868,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2605
2868
  oldValue: ''
2606
2869
  });
2607
2870
  });
2608
- (0, _globals.test)('`options.watch` should be trigger in orders', function () {
2871
+ (0, _globals.test)('`options.watch` should be triggered in orders', function () {
2609
2872
  var changeTimes = 0;
2610
2873
  var updateChangeTimes = function updateChangeTimes(e) {
2611
2874
  void e;
@@ -2723,38 +2986,38 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2723
2986
  });
2724
2987
  (0, _globals.describe)('`useUseCase` should work the same as `useReducers`', function () {
2725
2988
  (0, _globals.test)('`entity` should equal `defaultFile`', function () {
2726
- var _renderHook42 = (0, _react.renderHook)(function () {
2989
+ var _renderHook46 = (0, _react.renderHook)(function () {
2727
2990
  return (0, _.useUseCase)(mathUseCase);
2728
2991
  }),
2729
- result = _renderHook42.result;
2992
+ result = _renderHook46.result;
2730
2993
  var reducers = result.current;
2731
2994
  (0, _globals.expect)(Array.isArray(reducers)).toBe(false);
2732
2995
  });
2733
2996
  (0, _globals.test)('returned reducer should work', function () {
2734
- var _renderHook43 = (0, _react.renderHook)(function () {
2997
+ var _renderHook47 = (0, _react.renderHook)(function () {
2735
2998
  return (0, _.useUseCase)(mathUseCase);
2736
2999
  }),
2737
- result = _renderHook43.result;
3000
+ result = _renderHook47.result;
2738
3001
  var reducers = result.current;
2739
3002
  var add = reducers.add;
2740
3003
  (0, _globals.expect)(add(1, 2)).toBe(3);
2741
3004
  });
2742
3005
  (0, _globals.test)('`usecase` should be called only once if deps has not provided', function () {
2743
3006
  var mockUseCase = _globals.jest.fn(mathUseCase);
2744
- var _renderHook44 = (0, _react.renderHook)(function () {
3007
+ var _renderHook48 = (0, _react.renderHook)(function () {
2745
3008
  return (0, _.useUseCase)(mockUseCase);
2746
3009
  }),
2747
- rerender = _renderHook44.rerender;
3010
+ rerender = _renderHook48.rerender;
2748
3011
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(1);
2749
3012
  rerender();
2750
3013
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(1);
2751
3014
  });
2752
3015
  (0, _globals.test)('`usecase` should be called only once if deps has not changed', function () {
2753
3016
  var mockUseCase = _globals.jest.fn(mathUseCase);
2754
- var _renderHook45 = (0, _react.renderHook)(function () {
3017
+ var _renderHook49 = (0, _react.renderHook)(function () {
2755
3018
  return (0, _.useUseCase)(mockUseCase, {}, [1, 'x']);
2756
3019
  }),
2757
- rerender = _renderHook45.rerender;
3020
+ rerender = _renderHook49.rerender;
2758
3021
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(1);
2759
3022
  rerender();
2760
3023
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(1);
@@ -2762,10 +3025,10 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2762
3025
  (0, _globals.test)('`usecase` should be called if deps has changed', function () {
2763
3026
  var i = 0;
2764
3027
  var mockUseCase = _globals.jest.fn(mathUseCase);
2765
- var _renderHook46 = (0, _react.renderHook)(function () {
3028
+ var _renderHook50 = (0, _react.renderHook)(function () {
2766
3029
  return (0, _.useUseCase)(mockUseCase, {}, [i++, 'x']);
2767
3030
  }),
2768
- rerender = _renderHook46.rerender;
3031
+ rerender = _renderHook50.rerender;
2769
3032
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(1);
2770
3033
  rerender();
2771
3034
  (0, _globals.expect)(mockUseCase).toHaveBeenCalledTimes(2);
@@ -2849,12 +3112,12 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2849
3112
  (0, _globals.expect)(subtractionReducer).toHaveReturnedWith(4);
2850
3113
  });
2851
3114
  (0, _globals.test)('`options.extraValue` should be added after call `add` method', function () {
2852
- var _renderHook47 = (0, _react.renderHook)(function () {
3115
+ var _renderHook51 = (0, _react.renderHook)(function () {
2853
3116
  return (0, _.useUseCase)(mathUseCase, {
2854
3117
  extraValue: 5
2855
3118
  });
2856
3119
  }),
2857
- result = _renderHook47.result;
3120
+ result = _renderHook51.result;
2858
3121
  var reducers = result.current;
2859
3122
  var add = reducers.add;
2860
3123
  (0, _globals.expect)(add(1, 2)).toBe(8);
@@ -2862,7 +3125,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2862
3125
  (0, _globals.test)('when `options` has changed, it should not trigger update', function () {
2863
3126
  var onUpdate = _globals.jest.fn();
2864
3127
  var onDeepUpdate = _globals.jest.fn();
2865
- var _renderHook48 = (0, _react.renderHook)(function () {
3128
+ var _renderHook52 = (0, _react.renderHook)(function () {
2866
3129
  var _useState7 = (0, _react2.useState)(0),
2867
3130
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
2868
3131
  extraValue = _useState8[0],
@@ -2878,7 +3141,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2878
3141
  }, [reducers]);
2879
3142
  return setExtraValue;
2880
3143
  }),
2881
- result = _renderHook48.result;
3144
+ result = _renderHook52.result;
2882
3145
  (0, _globals.expect)(onUpdate).toHaveBeenCalledTimes(0);
2883
3146
  (0, _globals.expect)(onDeepUpdate).toHaveBeenCalledTimes(0);
2884
3147
  (0, _react.act)(function () {
@@ -2890,7 +3153,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2890
3153
  (0, _globals.test)('when `deps` change, it should update reducers', function () {
2891
3154
  var onUpdate = _globals.jest.fn();
2892
3155
  var onDeepUpdate = _globals.jest.fn();
2893
- var _renderHook49 = (0, _react.renderHook)(function () {
3156
+ var _renderHook53 = (0, _react.renderHook)(function () {
2894
3157
  var _useState9 = (0, _react2.useState)(0),
2895
3158
  _useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
2896
3159
  extraValue = _useState0[0],
@@ -2906,7 +3169,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2906
3169
  }, [reducers]);
2907
3170
  return setExtraValue;
2908
3171
  }),
2909
- result = _renderHook49.result;
3172
+ result = _renderHook53.result;
2910
3173
  (0, _globals.expect)(onUpdate).toHaveBeenCalledTimes(0);
2911
3174
  (0, _globals.expect)(onDeepUpdate).toHaveBeenCalledTimes(0);
2912
3175
  (0, _react.act)(function () {
@@ -2918,7 +3181,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2918
3181
  (0, _globals.test)('empty `deps` should not update reducers', function () {
2919
3182
  var onUpdate = _globals.jest.fn();
2920
3183
  var onDeepUpdate = _globals.jest.fn();
2921
- var _renderHook50 = (0, _react.renderHook)(function () {
3184
+ var _renderHook54 = (0, _react.renderHook)(function () {
2922
3185
  var _useState1 = (0, _react2.useState)(0),
2923
3186
  _useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
2924
3187
  extraValue = _useState10[0],
@@ -2934,7 +3197,7 @@ var useDeepCompareUpdate = function useDeepCompareUpdate(callback, deps) {
2934
3197
  }, [reducers]);
2935
3198
  return setExtraValue;
2936
3199
  }),
2937
- result = _renderHook50.result;
3200
+ result = _renderHook54.result;
2938
3201
  (0, _globals.expect)(onUpdate).toHaveBeenCalledTimes(0);
2939
3202
  (0, _globals.expect)(onDeepUpdate).toHaveBeenCalledTimes(0);
2940
3203
  (0, _react.act)(function () {