testeranto 0.48.1 → 0.48.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.
- package/dist/common/subPackages/react-test-renderer/MemoExoticComponent/node.js +44 -0
- package/dist/common/subPackages/react-test-renderer/fc/node.js +50 -0
- package/dist/common/subPackages/react-test-renderer/fc/web.js +50 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/subPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
- package/dist/module/subPackages/react-test-renderer/fc/web.js +22 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +8 -0
- package/dist/types/subPackages/react-test-renderer/component/node.d.ts +1 -1
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +1 -1
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +9 -0
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +9 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +5 -1
- package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +67 -0
- package/src/subPackages/react-test-renderer/fc/web.ts +77 -0
- /package/src/subPackages/react-test-renderer/fc/{node.tsx → node.ts} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import test from "../../../Web";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import renderer, { act } from "react-test-renderer";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ITTestShape,
|
|
8
|
+
ITestImplementation,
|
|
9
|
+
ITestSpecification
|
|
10
|
+
} from "../../../core";
|
|
11
|
+
|
|
12
|
+
export type IInput = React.FC;
|
|
13
|
+
export type IWhenShape = unknown;
|
|
14
|
+
export type IThenShape = unknown;
|
|
15
|
+
|
|
16
|
+
export type ISpec<ITestShape extends ITTestShape> = ITestSpecification<
|
|
17
|
+
ITestShape,
|
|
18
|
+
any,
|
|
19
|
+
any,
|
|
20
|
+
any,
|
|
21
|
+
IThenShape
|
|
22
|
+
>
|
|
23
|
+
export default <
|
|
24
|
+
ITestShape extends ITTestShape,
|
|
25
|
+
IPropShape
|
|
26
|
+
>(
|
|
27
|
+
testImplementations: ITestImplementation<
|
|
28
|
+
IPropShape,
|
|
29
|
+
renderer.ReactTestRenderer,
|
|
30
|
+
IWhenShape,
|
|
31
|
+
IThenShape,
|
|
32
|
+
ITestShape
|
|
33
|
+
>,
|
|
34
|
+
testSpecifications: ISpec<ITestShape>,
|
|
35
|
+
testInput: IInput
|
|
36
|
+
) =>
|
|
37
|
+
test<
|
|
38
|
+
ITestShape,
|
|
39
|
+
IInput,
|
|
40
|
+
any,
|
|
41
|
+
renderer.ReactTestRenderer,
|
|
42
|
+
unknown, unknown, unknown, unknown
|
|
43
|
+
>(
|
|
44
|
+
testInput,
|
|
45
|
+
testSpecifications,
|
|
46
|
+
testImplementations,
|
|
47
|
+
{
|
|
48
|
+
beforeEach: function (
|
|
49
|
+
CComponent,
|
|
50
|
+
props
|
|
51
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
52
|
+
|
|
53
|
+
return new Promise((res, rej) => {
|
|
54
|
+
let component: renderer.ReactTestRenderer;
|
|
55
|
+
act(() => {
|
|
56
|
+
component = renderer.create(
|
|
57
|
+
React.createElement(CComponent, props, [])
|
|
58
|
+
);
|
|
59
|
+
res(component);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
},
|
|
65
|
+
andWhen: async function (
|
|
66
|
+
renderer: renderer.ReactTestRenderer,
|
|
67
|
+
actioner: () => (a: any) => any
|
|
68
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
69
|
+
await act(() => actioner()(renderer));
|
|
70
|
+
return renderer;
|
|
71
|
+
},
|
|
72
|
+
afterEach: async (store, key, artificer) => {
|
|
73
|
+
console.log("afterall")
|
|
74
|
+
store.unmount();
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
);
|
|
File without changes
|