@ornikar/jest-config-react-native 1.1.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.2.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@1.1.0...@ornikar/jest-config-react-native@1.2.0) (2021-11-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * add waitFor in stories mock [no issue] ([#550](https://github.com/ornikar/shared-configs/issues/550)) ([9a4f254](https://github.com/ornikar/shared-configs/commit/9a4f25431cf556099b6c48dd52670937526c19b7))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.1.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@1.0.1...@ornikar/jest-config-react-native@1.1.0) (2021-11-29)
7
18
 
8
19
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- const { render } = require('@testing-library/react-native');
5
+ const { render, waitFor } = require('@testing-library/react-native');
6
6
  const React = require('react');
7
7
 
8
8
  const decorateStory = (storyFn, decorators) =>
@@ -51,7 +51,7 @@ exports.storiesOf = (groupName) => {
51
51
  const parameters = { ...localParameters, ...storyParameters };
52
52
  const context = { name: storyName, parameters };
53
53
  const { jest } = parameters;
54
- const { ignore, ignoreDecorators, createBeforeAfterEachCallbacks } = jest || {};
54
+ const { ignore, ignoreDecorators, createBeforeAfterEachCallbacks, waitFor: waitForExpectation } = jest || {};
55
55
 
56
56
  if (ignore) {
57
57
  test.skip(storyName, () => {});
@@ -65,13 +65,14 @@ exports.storiesOf = (groupName) => {
65
65
  if (after) afterEach(after);
66
66
  }
67
67
 
68
- it(storyName, () => {
68
+ it(storyName, async () => {
69
69
  const WrappingComponent = ignoreDecorators
70
70
  ? undefined
71
71
  : ({ children }) => decorateStory(() => children, [...localDecorators, ...globalDecorators])(context);
72
72
 
73
- const component = render(React.createElement(WrappingComponent, { children: story(context) }));
74
- expect(component.toJSON()).toMatchSnapshot();
73
+ const rtlApi = render(React.createElement(WrappingComponent, { children: story(context) }));
74
+ if (waitForExpectation) await waitFor(() => waitForExpectation(rtlApi, expect));
75
+ expect(rtlApi.toJSON()).toMatchSnapshot();
75
76
  });
76
77
  });
77
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/jest-config-react-native",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "jest config",
5
5
  "repository": "ornikar/shared-configs",
6
6
  "main": "jest-preset.js",
@@ -28,5 +28,5 @@
28
28
  "jest-expo": "41.0.0",
29
29
  "react": "16.13.1"
30
30
  },
31
- "gitHead": "ac346b8a30d6be08957f38155a238cd1a50b8144"
31
+ "gitHead": "e9b27357cfc54c45614da929b85995602e760be6"
32
32
  }