@tramvai/test-react 2.2.2 → 2.4.0

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/lib/index.es.js CHANGED
@@ -9,7 +9,7 @@ import { waitRaf } from '@tramvai/test-jsdom';
9
9
  import { renderHook, act as act$1 } from '@testing-library/react-hooks';
10
10
 
11
11
  const testComponent = (element, { providers, initialState, store, stores, di, context = createMockContext({ initialState, providers, di, store, stores }), currentRoute, currentUrl, router = createMockRouter({ currentRoute, currentUrl }), renderOptions, } = {}) => {
12
- const Wrapper = ({ children }) => (jsx(Provider, Object.assign({ context: context, serverState: initialState }, { children: jsx(DIContext.Provider, Object.assign({ value: context.di }, { children: jsx(Provider$1, Object.assign({ router: router }, { children: children }), void 0) }), void 0) }), void 0));
12
+ const Wrapper = ({ children }) => (jsx(Provider, Object.assign({ context: context, serverState: initialState }, { children: jsx(DIContext.Provider, Object.assign({ value: context.di }, { children: jsx(Provider$1, Object.assign({ router: router, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.router }, { children: children }), void 0) }), void 0) }), void 0));
13
13
  const renderResults = render(jsx(Wrapper, { children: element }, void 0), renderOptions);
14
14
  return {
15
15
  render: renderResults,
@@ -36,7 +36,7 @@ const testHook = (hookCallback, { providers, initialState, store, stores, di, co
36
36
  const { result, rerender } = renderHook(hookCallback, {
37
37
  ...renderOptions,
38
38
  wrapper: ({ children }) => {
39
- return (jsx(Provider, Object.assign({ context: context }, { children: jsx(DIContext.Provider, Object.assign({ value: context.di }, { children: jsx(Provider$1, Object.assign({ router: router }, { children: jsx(Wrapper, { children: children }, void 0) }), void 0) }), void 0) }), void 0));
39
+ return (jsx(Provider, Object.assign({ context: context, serverState: initialState }, { children: jsx(DIContext.Provider, Object.assign({ value: context.di }, { children: jsx(Provider$1, Object.assign({ router: router, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.router }, { children: jsx(Wrapper, { children: children }, void 0) }), void 0) }), void 0) }), void 0));
40
40
  },
41
41
  });
42
42
  return {
package/lib/index.js CHANGED
@@ -12,7 +12,7 @@ var testJsdom = require('@tramvai/test-jsdom');
12
12
  var reactHooks = require('@testing-library/react-hooks');
13
13
 
14
14
  const testComponent = (element, { providers, initialState, store, stores, di, context = testMocks.createMockContext({ initialState, providers, di, store, stores }), currentRoute, currentUrl, router: router$1 = testMocks.createMockRouter({ currentRoute, currentUrl }), renderOptions, } = {}) => {
15
- const Wrapper = ({ children }) => (jsxRuntime.jsx(state.Provider, Object.assign({ context: context, serverState: initialState }, { children: jsxRuntime.jsx(react$1.DIContext.Provider, Object.assign({ value: context.di }, { children: jsxRuntime.jsx(router.Provider, Object.assign({ router: router$1 }, { children: children }), void 0) }), void 0) }), void 0));
15
+ const Wrapper = ({ children }) => (jsxRuntime.jsx(state.Provider, Object.assign({ context: context, serverState: initialState }, { children: jsxRuntime.jsx(react$1.DIContext.Provider, Object.assign({ value: context.di }, { children: jsxRuntime.jsx(router.Provider, Object.assign({ router: router$1, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.router }, { children: children }), void 0) }), void 0) }), void 0));
16
16
  const renderResults = react.render(jsxRuntime.jsx(Wrapper, { children: element }, void 0), renderOptions);
17
17
  return {
18
18
  render: renderResults,
@@ -39,7 +39,7 @@ const testHook = (hookCallback, { providers, initialState, store, stores, di, co
39
39
  const { result, rerender } = reactHooks.renderHook(hookCallback, {
40
40
  ...renderOptions,
41
41
  wrapper: ({ children }) => {
42
- return (jsxRuntime.jsx(state.Provider, Object.assign({ context: context }, { children: jsxRuntime.jsx(react$1.DIContext.Provider, Object.assign({ value: context.di }, { children: jsxRuntime.jsx(router.Provider, Object.assign({ router: router$1 }, { children: jsxRuntime.jsx(Wrapper, { children: children }, void 0) }), void 0) }), void 0) }), void 0));
42
+ return (jsxRuntime.jsx(state.Provider, Object.assign({ context: context, serverState: initialState }, { children: jsxRuntime.jsx(react$1.DIContext.Provider, Object.assign({ value: context.di }, { children: jsxRuntime.jsx(router.Provider, Object.assign({ router: router$1, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.router }, { children: jsxRuntime.jsx(Wrapper, { children: children }, void 0) }), void 0) }), void 0) }), void 0));
43
43
  },
44
44
  });
45
45
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/test-react",
3
- "version": "2.2.2",
3
+ "version": "2.4.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -20,12 +20,12 @@
20
20
  "dependencies": {
21
21
  "@testing-library/react": "^12.1.4",
22
22
  "@testing-library/react-hooks": "^7.0.2",
23
- "@tinkoff/router": "0.1.79",
24
- "@tramvai/react": "2.2.2",
25
- "@tramvai/state": "2.2.2",
26
- "@tramvai/test-jsdom": "2.2.2",
27
- "@tramvai/test-mocks": "2.2.2",
28
- "@tramvai/tokens-common": "2.2.2",
23
+ "@tinkoff/router": "0.1.80",
24
+ "@tramvai/react": "2.4.0",
25
+ "@tramvai/state": "2.4.0",
26
+ "@tramvai/test-jsdom": "2.4.0",
27
+ "@tramvai/test-mocks": "2.4.0",
28
+ "@tramvai/tokens-common": "2.4.0",
29
29
  "tslib": "^2.0.3"
30
30
  },
31
31
  "peerDependencies": {