@papillonarts/setup 0.41.0 → 0.42.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/build/jest/utility.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared test utilities
|
|
2
|
+
* Shared test utilities provided by @papillonarts/setup/jest.
|
|
3
3
|
*
|
|
4
|
-
* These utilities wrap common testing patterns used across
|
|
4
|
+
* These utilities wrap common testing patterns used across packages,
|
|
5
5
|
* particularly for snapshot testing with React components.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import { renderSnapshot } from '
|
|
15
|
+
* import { renderSnapshot } from '@papillonarts/setup/jest'
|
|
16
16
|
* import { defaults } from './Component.feature'
|
|
17
17
|
*
|
|
18
18
|
* test('must match defaults()', () => {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
import type { ReactElement } from 'react';
|
|
24
|
-
export declare const renderSnapshot: (component: ReactElement) =>
|
|
24
|
+
export declare const renderSnapshot: (component: ReactElement) => any;
|
|
25
25
|
/**
|
|
26
26
|
* Renders an async component and matches it against a snapshot.
|
|
27
27
|
* Wraps the render in React's act() to ensure all updates are flushed.
|
|
@@ -31,7 +31,7 @@ export declare const renderSnapshot: (component: ReactElement) => void;
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```typescript
|
|
34
|
-
* import { renderSnapshotAsync } from '
|
|
34
|
+
* import { renderSnapshotAsync } from '@papillonarts/setup/jest'
|
|
35
35
|
* import { async } from './Component.feature'
|
|
36
36
|
*
|
|
37
37
|
* test('must match async()', async () => {
|
|
@@ -39,7 +39,7 @@ export declare const renderSnapshot: (component: ReactElement) => void;
|
|
|
39
39
|
* })
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare const renderSnapshotAsync: (component: ReactElement | Promise<ReactElement>) => Promise<
|
|
42
|
+
export declare const renderSnapshotAsync: (component: ReactElement | Promise<ReactElement>) => Promise<any>;
|
|
43
43
|
/**
|
|
44
44
|
* Creates a mock store with default configuration.
|
|
45
45
|
* Useful for testing Redux-connected components.
|
|
@@ -49,7 +49,7 @@ export declare const renderSnapshotAsync: (component: ReactElement | Promise<Rea
|
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
51
|
* ```typescript
|
|
52
|
-
* import { createMockStore } from '
|
|
52
|
+
* import { createMockStore } from '@papillonarts/setup/jest'
|
|
53
53
|
*
|
|
54
54
|
* const store = createMockStore({ context: { cars: [] } })
|
|
55
55
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/jest/utility.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/jest/utility.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,cAAc,GAAI,WAAW,YAAY,QAAqD,CAAA;AAE3G;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,GAAU,WAAW,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,iBACG,CAAA;AAE5F;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,GAAI,iBAAiB,OAIhD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO,GAAU,WAAW,MAAM,OAAO,EAAE,gBAAc,EAAE,iBAAa,KAAG,OAAO,CAAC,IAAI,CASnG,CAAA"}
|
package/build/jest/utility.js
CHANGED
|
@@ -8,12 +8,11 @@ exports.waitFor = exports.renderSnapshotAsync = exports.renderSnapshot = exports
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
/**
|
|
11
|
-
* Shared test utilities
|
|
11
|
+
* Shared test utilities provided by @papillonarts/setup/jest.
|
|
12
12
|
*
|
|
13
|
-
* These utilities wrap common testing patterns used across
|
|
13
|
+
* These utilities wrap common testing patterns used across packages,
|
|
14
14
|
* particularly for snapshot testing with React components.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Renders a component and matches it against a snapshot.
|
|
19
18
|
*
|
|
@@ -22,7 +21,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
22
21
|
*
|
|
23
22
|
* @example
|
|
24
23
|
* ```typescript
|
|
25
|
-
* import { renderSnapshot } from '
|
|
24
|
+
* import { renderSnapshot } from '@papillonarts/setup/jest'
|
|
26
25
|
* import { defaults } from './Component.feature'
|
|
27
26
|
*
|
|
28
27
|
* test('must match defaults()', () => {
|
|
@@ -32,7 +31,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
32
31
|
*/
|
|
33
32
|
|
|
34
33
|
var renderSnapshot = exports.renderSnapshot = function renderSnapshot(component) {
|
|
35
|
-
return
|
|
34
|
+
return global.renderToJSON(component).toMatchSnapshot();
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
/**
|
|
@@ -44,7 +43,7 @@ var renderSnapshot = exports.renderSnapshot = function renderSnapshot(component)
|
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
45
|
* ```typescript
|
|
47
|
-
* import { renderSnapshotAsync } from '
|
|
46
|
+
* import { renderSnapshotAsync } from '@papillonarts/setup/jest'
|
|
48
47
|
* import { async } from './Component.feature'
|
|
49
48
|
*
|
|
50
49
|
* test('must match async()', async () => {
|
|
@@ -54,11 +53,9 @@ var renderSnapshot = exports.renderSnapshot = function renderSnapshot(component)
|
|
|
54
53
|
*/
|
|
55
54
|
var renderSnapshotAsync = exports.renderSnapshotAsync = /*#__PURE__*/function () {
|
|
56
55
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(component) {
|
|
57
|
-
var _t2;
|
|
58
56
|
return _regenerator["default"].wrap(function (_context2) {
|
|
59
57
|
while (1) switch (_context2.prev = _context2.next) {
|
|
60
58
|
case 0:
|
|
61
|
-
_t2 = expect;
|
|
62
59
|
_context2.next = 1;
|
|
63
60
|
return global.act(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
64
61
|
var _t;
|
|
@@ -75,10 +72,10 @@ var renderSnapshotAsync = exports.renderSnapshotAsync = /*#__PURE__*/function ()
|
|
|
75
72
|
return _context.stop();
|
|
76
73
|
}
|
|
77
74
|
}, _callee);
|
|
78
|
-
})));
|
|
75
|
+
}))).toMatchSnapshot();
|
|
79
76
|
case 1:
|
|
80
77
|
_context2.next = 2;
|
|
81
|
-
return
|
|
78
|
+
return _context2.sent;
|
|
82
79
|
case 2:
|
|
83
80
|
return _context2.abrupt("return", _context2.sent);
|
|
84
81
|
case 3:
|
|
@@ -101,7 +98,7 @@ var renderSnapshotAsync = exports.renderSnapshotAsync = /*#__PURE__*/function ()
|
|
|
101
98
|
*
|
|
102
99
|
* @example
|
|
103
100
|
* ```typescript
|
|
104
|
-
* import { createMockStore } from '
|
|
101
|
+
* import { createMockStore } from '@papillonarts/setup/jest'
|
|
105
102
|
*
|
|
106
103
|
* const store = createMockStore({ context: { cars: [] } })
|
|
107
104
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@papillonarts/setup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Papillon Arts Setup",
|
|
5
5
|
"homepage": "https://github.com/papillonarts/papillonarts/tree/master/packages/setup",
|
|
6
6
|
"repository": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"build-acceptance": "npm run build",
|
|
38
38
|
"build-release": "npm run build"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4b8cd00e12214132f87b702855aa37dc506dbadd"
|
|
41
41
|
}
|