@trackunit/react-core-contexts-test 0.1.13 → 0.1.14

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 (3) hide show
  1. package/HookRenderer.js +16 -22
  2. package/index2.js +297 -2644
  3. package/package.json +4 -4
package/HookRenderer.js CHANGED
@@ -11,28 +11,22 @@ import '@apollo/client/link/error';
11
11
  import '@apollo/client/testing';
12
12
  import 'graphql';
13
13
 
14
- const reactHooksRenderHook = (callback, getMockedCompositionRoot) => __awaiter(void 0, void 0, void 0, function* () {
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- const wrapper = ({
17
- children
18
- }) => {
19
- // eslint-disable-next-line react/jsx-no-useless-fragment
20
- return getMockedCompositionRoot(jsx(Fragment, {
21
- children: children
22
- }));
23
- };
24
- let renderedHook;
25
- // This is added here to make storybook work and to ensure the right act is loaded for hooks.
26
- // eslint-disable-next-line @typescript-eslint/no-var-requires
27
- yield act(() => __awaiter(void 0, void 0, void 0, function* () {
28
- renderedHook = yield renderHook(callback, {
29
- wrapper
30
- });
31
- }));
32
- yield act(() => __awaiter(void 0, void 0, void 0, function* () {
33
- yield flushPromises();
34
- }));
35
- return renderedHook;
14
+ const reactHooksRenderHook = (callback, getMockedCompositionRoot) => __awaiter(void 0, void 0, void 0, function* () {
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ const wrapper = ({ children }) => {
17
+ // eslint-disable-next-line react/jsx-no-useless-fragment
18
+ return getMockedCompositionRoot(jsx(Fragment, { children: children }));
19
+ };
20
+ let renderedHook;
21
+ // This is added here to make storybook work and to ensure the right act is loaded for hooks.
22
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
23
+ yield act(() => __awaiter(void 0, void 0, void 0, function* () {
24
+ renderedHook = yield renderHook(callback, { wrapper });
25
+ }));
26
+ yield act(() => __awaiter(void 0, void 0, void 0, function* () {
27
+ yield flushPromises();
28
+ }));
29
+ return renderedHook;
36
30
  });
37
31
 
38
32
  export { reactHooksRenderHook };