testeranto 0.47.24 → 0.47.26
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/jsx/mounted.web.js → react-dom/component/node.js} +2 -2
- package/dist/common/subPackages/react-dom/jsx/web.js +76 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/subPackages/{react/jsx/mounted.web.js → react-dom/component/node.js} +1 -1
- package/dist/module/subPackages/react-dom/jsx/web.js +48 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/Node.d.ts +9 -9
- package/dist/types/Web.d.ts +9 -9
- package/dist/types/subPackages/react/component/node.d.ts +10 -7
- package/dist/types/subPackages/react/component/web.d.ts +4 -4
- package/dist/types/subPackages/react/jsx/node.d.ts +6 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +6 -4
- package/dist/types/subPackages/react-dom/component/node.d.ts +19 -0
- package/dist/types/subPackages/react-dom/component/web.d.ts +19 -0
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +16 -0
- package/dist/types/subPackages/react-test-render/component/node.d.ts +6 -6
- package/dist/types/subPackages/react-test-render/component/web.d.ts +6 -6
- package/dist/types/subPackages/react-test-render/jsx/node.d.ts +6 -6
- package/dist/types/subPackages/react-test-render/jsx/web.d.ts +7 -7
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Node.ts +21 -15
- package/src/Web.ts +19 -13
- package/src/subPackages/react/component/node.ts +38 -15
- package/src/subPackages/react/component/web.ts +10 -10
- package/src/subPackages/react/jsx/node.ts +19 -13
- package/src/subPackages/react/jsx/web.ts +19 -13
- package/src/subPackages/{react/jsx/mounted.web.ts → react-dom/component/node.ts} +24 -18
- package/src/subPackages/{react/component/mounted.web.ts → react-dom/component/web.ts} +23 -17
- package/src/subPackages/react-dom/jsx/web.ts +117 -0
- package/src/subPackages/react-test-render/component/node.ts +16 -10
- package/src/subPackages/react-test-render/component/web.ts +16 -10
- package/src/subPackages/react-test-render/jsx/node.ts +13 -7
- package/src/subPackages/react-test-render/jsx/web.ts +16 -11
- package/dist/types/subPackages/react/component/mounted.web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/mounted.web.d.ts +0 -12
- /package/dist/common/subPackages/{react/component/mounted.web.js → react-dom/component/web.js} +0 -0
- /package/dist/module/subPackages/{react/component/mounted.web.js → react-dom/component/web.js} +0 -0
|
@@ -1,26 +1,49 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
|
|
4
4
|
import Testeranto from "../../../Node";
|
|
5
5
|
|
|
6
|
-
type
|
|
7
|
-
type
|
|
6
|
+
type IWhenShape = any;
|
|
7
|
+
type IThenShape = any;
|
|
8
8
|
|
|
9
|
-
type InitialState = unknown;
|
|
10
9
|
type IInput = typeof React.Component;
|
|
11
|
-
type ISelection = CElement<any, any>
|
|
12
|
-
type Store = CElement<any, any>
|
|
13
|
-
type Subject = CElement<any, any>
|
|
10
|
+
type ISelection = React.CElement<any, any>
|
|
11
|
+
type Store = React.CElement<any, any>
|
|
12
|
+
type Subject = React.CElement<any, any>
|
|
14
13
|
|
|
15
|
-
export
|
|
14
|
+
export type IImpl<
|
|
15
|
+
ISpec extends ITTestShape,
|
|
16
|
+
IState
|
|
17
|
+
> = ITestImplementation<
|
|
18
|
+
IState,
|
|
19
|
+
ISelection,
|
|
20
|
+
IWhenShape,
|
|
21
|
+
IThenShape,
|
|
22
|
+
ISpec
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export type ISpec<
|
|
26
|
+
T extends ITTestShape
|
|
27
|
+
> = ITestSpecification<
|
|
28
|
+
T,
|
|
29
|
+
Subject,
|
|
30
|
+
Store,
|
|
31
|
+
ISelection,
|
|
32
|
+
IThenShape
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
export default <
|
|
36
|
+
ITestShape extends ITTestShape,
|
|
37
|
+
IState
|
|
38
|
+
>(
|
|
16
39
|
testImplementations: ITestImplementation<
|
|
17
|
-
|
|
40
|
+
IState,
|
|
18
41
|
ISelection,
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
IWhenShape,
|
|
43
|
+
IThenShape,
|
|
21
44
|
ITestShape
|
|
22
45
|
>,
|
|
23
|
-
testSpecifications:
|
|
46
|
+
testSpecifications: ISpec<ITestShape>,
|
|
24
47
|
testInput: IInput
|
|
25
48
|
) => {
|
|
26
49
|
return Testeranto<
|
|
@@ -29,9 +52,9 @@ export default <ITestShape extends ITTestShape>(
|
|
|
29
52
|
Subject,
|
|
30
53
|
Store,
|
|
31
54
|
ISelection,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
IThenShape,
|
|
56
|
+
IWhenShape,
|
|
57
|
+
IState
|
|
35
58
|
>(
|
|
36
59
|
testInput,
|
|
37
60
|
testSpecifications,
|
|
@@ -5,8 +5,8 @@ import Testeranto from "../../../Web";
|
|
|
5
5
|
|
|
6
6
|
import { CElement } from "react";
|
|
7
7
|
|
|
8
|
-
type
|
|
9
|
-
type
|
|
8
|
+
type IWhenShape = any;
|
|
9
|
+
type IThenShape = any;
|
|
10
10
|
|
|
11
11
|
type Super<T> = T extends infer U ? U : object;
|
|
12
12
|
|
|
@@ -21,9 +21,9 @@ export type IImpl<
|
|
|
21
21
|
IState
|
|
22
22
|
> = ITestImplementation<
|
|
23
23
|
IState,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
ISelection,
|
|
25
|
+
IWhenShape,
|
|
26
|
+
IThenShape,
|
|
27
27
|
ISpec
|
|
28
28
|
>
|
|
29
29
|
|
|
@@ -34,7 +34,7 @@ export type ISpec<
|
|
|
34
34
|
Subject,
|
|
35
35
|
Store,
|
|
36
36
|
ISelection,
|
|
37
|
-
|
|
37
|
+
IThenShape
|
|
38
38
|
>;
|
|
39
39
|
|
|
40
40
|
export default <
|
|
@@ -44,8 +44,8 @@ export default <
|
|
|
44
44
|
testImplementations: ITestImplementation<
|
|
45
45
|
IState,
|
|
46
46
|
ISelection,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
IWhenShape,
|
|
48
|
+
IThenShape,
|
|
49
49
|
ITestShape
|
|
50
50
|
>,
|
|
51
51
|
testSpecifications: ISpec<ITestShape>,
|
|
@@ -57,8 +57,8 @@ export default <
|
|
|
57
57
|
Subject,
|
|
58
58
|
Store,
|
|
59
59
|
ISelection,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
IThenShape,
|
|
61
|
+
IWhenShape,
|
|
62
62
|
IState
|
|
63
63
|
>(
|
|
64
64
|
testInput,
|
|
@@ -3,34 +3,40 @@ import React, { CElement } from "react";
|
|
|
3
3
|
import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
|
|
4
4
|
import Testeranto from "../../../Node";
|
|
5
5
|
|
|
6
|
-
type
|
|
7
|
-
type
|
|
6
|
+
type IWhenShape = any;
|
|
7
|
+
type IThenShape = any;
|
|
8
8
|
|
|
9
9
|
type InitialState = unknown;
|
|
10
10
|
type IInput = typeof React.Component;
|
|
11
11
|
type ISelection = CElement<any, any>
|
|
12
|
-
type
|
|
13
|
-
type
|
|
12
|
+
type IStore = CElement<any, any>
|
|
13
|
+
type ISubject = CElement<any, any>
|
|
14
14
|
|
|
15
15
|
export default <ITestShape extends ITTestShape>(
|
|
16
16
|
testImplementations: ITestImplementation<
|
|
17
17
|
InitialState,
|
|
18
18
|
ISelection,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
IWhenShape,
|
|
20
|
+
IThenShape,
|
|
21
21
|
ITestShape
|
|
22
22
|
>,
|
|
23
|
-
testSpecifications: ITestSpecification<
|
|
23
|
+
testSpecifications: ITestSpecification<
|
|
24
|
+
ITestShape,
|
|
25
|
+
ISubject,
|
|
26
|
+
IStore,
|
|
27
|
+
ISelection,
|
|
28
|
+
IThenShape
|
|
29
|
+
>,
|
|
24
30
|
testInput: IInput
|
|
25
31
|
) => {
|
|
26
32
|
return Testeranto<
|
|
27
33
|
ITestShape,
|
|
28
34
|
IInput,
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
ISubject,
|
|
36
|
+
IStore,
|
|
31
37
|
ISelection,
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
IThenShape,
|
|
39
|
+
IWhenShape,
|
|
34
40
|
InitialState
|
|
35
41
|
>(
|
|
36
42
|
testInput,
|
|
@@ -38,13 +44,13 @@ export default <ITestShape extends ITTestShape>(
|
|
|
38
44
|
testImplementations,
|
|
39
45
|
{
|
|
40
46
|
beforeEach: async (
|
|
41
|
-
): Promise<
|
|
47
|
+
): Promise<IStore> => {
|
|
42
48
|
return new Promise((resolve, rej) => {
|
|
43
49
|
resolve(React.createElement(testInput, {
|
|
44
50
|
}, []));
|
|
45
51
|
});
|
|
46
52
|
},
|
|
47
|
-
andWhen: function (s:
|
|
53
|
+
andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
48
54
|
return actioner()(s);
|
|
49
55
|
},
|
|
50
56
|
},
|
|
@@ -5,34 +5,40 @@ import Testeranto from "../../../Web";
|
|
|
5
5
|
|
|
6
6
|
import { CElement } from "react";
|
|
7
7
|
|
|
8
|
-
type
|
|
9
|
-
type
|
|
8
|
+
type IWhenShape = any;
|
|
9
|
+
type IThenShape = any;
|
|
10
10
|
|
|
11
11
|
type InitialState = unknown;
|
|
12
12
|
type IInput = typeof React.Component;
|
|
13
13
|
type ISelection = CElement<any, any>
|
|
14
|
-
type
|
|
15
|
-
type
|
|
14
|
+
type IStore = CElement<any, any>
|
|
15
|
+
type ISubject = CElement<any, any>
|
|
16
16
|
|
|
17
17
|
export default <ITestShape extends ITTestShape>(
|
|
18
18
|
testImplementations: ITestImplementation<
|
|
19
19
|
InitialState,
|
|
20
20
|
ISelection,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
IWhenShape,
|
|
22
|
+
IThenShape,
|
|
23
23
|
ITestShape
|
|
24
24
|
>,
|
|
25
|
-
testSpecifications: ITestSpecification<
|
|
25
|
+
testSpecifications: ITestSpecification<
|
|
26
|
+
ITestShape,
|
|
27
|
+
ISubject,
|
|
28
|
+
IStore,
|
|
29
|
+
ISelection,
|
|
30
|
+
IThenShape
|
|
31
|
+
>,
|
|
26
32
|
testInput: IInput
|
|
27
33
|
) => {
|
|
28
34
|
return Testeranto<
|
|
29
35
|
ITestShape,
|
|
30
36
|
IInput,
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
ISubject,
|
|
38
|
+
IStore,
|
|
33
39
|
ISelection,
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
IThenShape,
|
|
41
|
+
IWhenShape,
|
|
36
42
|
InitialState
|
|
37
43
|
>(
|
|
38
44
|
testInput,
|
|
@@ -40,13 +46,13 @@ export default <ITestShape extends ITTestShape>(
|
|
|
40
46
|
testImplementations,
|
|
41
47
|
{
|
|
42
48
|
beforeEach: async (
|
|
43
|
-
): Promise<
|
|
49
|
+
): Promise<IStore> => {
|
|
44
50
|
return new Promise((resolve, rej) => {
|
|
45
51
|
resolve(React.createElement(testInput, {
|
|
46
52
|
}, []));
|
|
47
53
|
});
|
|
48
54
|
},
|
|
49
|
-
andWhen: function (s:
|
|
55
|
+
andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
50
56
|
return actioner()(s);
|
|
51
57
|
},
|
|
52
58
|
},
|
|
@@ -2,23 +2,23 @@ import React, { CElement } from "react";
|
|
|
2
2
|
import ReactDom from "react-dom/client";
|
|
3
3
|
|
|
4
4
|
import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
|
|
5
|
-
import Testeranto from "../../../
|
|
5
|
+
import Testeranto from "../../../Node";
|
|
6
6
|
|
|
7
7
|
type IInput = typeof React.Component;
|
|
8
8
|
type InitialState = unknown;
|
|
9
|
-
type
|
|
10
|
-
type
|
|
9
|
+
type IWhenShape = any;
|
|
10
|
+
type IThenShape = any;
|
|
11
11
|
type ISelection = {
|
|
12
12
|
htmlElement: HTMLElement,
|
|
13
13
|
reactElement: CElement<any, any>,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
type IStore = {
|
|
17
17
|
htmlElement: HTMLElement,
|
|
18
18
|
reactElement: CElement<any, any>,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
type
|
|
21
|
+
type ISubject = {
|
|
22
22
|
htmlElement: HTMLElement
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -26,11 +26,17 @@ export default <ITestShape extends ITTestShape>(
|
|
|
26
26
|
testImplementations: ITestImplementation<
|
|
27
27
|
InitialState,
|
|
28
28
|
ISelection,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
IWhenShape,
|
|
30
|
+
IThenShape,
|
|
31
31
|
ITestShape
|
|
32
32
|
>,
|
|
33
|
-
testSpecifications: ITestSpecification<
|
|
33
|
+
testSpecifications: ITestSpecification<
|
|
34
|
+
ITestShape,
|
|
35
|
+
ISubject,
|
|
36
|
+
IStore,
|
|
37
|
+
ISelection,
|
|
38
|
+
IThenShape
|
|
39
|
+
>,
|
|
34
40
|
testInput: IInput
|
|
35
41
|
) => {
|
|
36
42
|
class TesterantoComponent extends testInput {
|
|
@@ -48,11 +54,11 @@ export default <ITestShape extends ITTestShape>(
|
|
|
48
54
|
return Testeranto<
|
|
49
55
|
ITestShape,
|
|
50
56
|
IInput,
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
ISubject,
|
|
58
|
+
IStore,
|
|
53
59
|
ISelection,
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
IThenShape,
|
|
61
|
+
IWhenShape,
|
|
56
62
|
InitialState
|
|
57
63
|
>(
|
|
58
64
|
testInput,
|
|
@@ -62,7 +68,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
62
68
|
beforeAll: async (
|
|
63
69
|
prototype,
|
|
64
70
|
artificer
|
|
65
|
-
): Promise<
|
|
71
|
+
): Promise<ISubject> => {
|
|
66
72
|
return await new Promise((resolve, rej) => {
|
|
67
73
|
document.addEventListener("DOMContentLoaded", function () {
|
|
68
74
|
const elem = document.getElementById("root");
|
|
@@ -77,7 +83,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
77
83
|
ndx,
|
|
78
84
|
testRsource,
|
|
79
85
|
artificer
|
|
80
|
-
): Promise<
|
|
86
|
+
): Promise<IStore> => {
|
|
81
87
|
return new Promise((resolve, rej) => {
|
|
82
88
|
const reactElement = React.createElement(TesterantoComponent, {
|
|
83
89
|
done: (reactElement) => {
|
|
@@ -92,20 +98,20 @@ export default <ITestShape extends ITTestShape>(
|
|
|
92
98
|
ReactDom.createRoot(htmlElement).render(reactElement);
|
|
93
99
|
});
|
|
94
100
|
},
|
|
95
|
-
andWhen: function (s:
|
|
101
|
+
andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
96
102
|
return actioner()(s);
|
|
97
103
|
},
|
|
98
|
-
butThen: async function (s:
|
|
104
|
+
butThen: async function (s: IStore): Promise<ISelection> {
|
|
99
105
|
return s;
|
|
100
106
|
},
|
|
101
107
|
afterEach: async function (
|
|
102
|
-
store:
|
|
108
|
+
store: IStore,
|
|
103
109
|
ndx,
|
|
104
110
|
artificer
|
|
105
111
|
) {
|
|
106
112
|
return {};
|
|
107
113
|
},
|
|
108
|
-
afterAll: (store:
|
|
114
|
+
afterAll: (store: IStore, artificer) => {
|
|
109
115
|
return;
|
|
110
116
|
},
|
|
111
117
|
},
|
|
@@ -6,19 +6,19 @@ import Testeranto from "../../../Web";
|
|
|
6
6
|
|
|
7
7
|
type IInput = typeof React.Component;
|
|
8
8
|
type InitialState = unknown;
|
|
9
|
-
type
|
|
10
|
-
type
|
|
9
|
+
type IWhenShape = any;
|
|
10
|
+
type IThenShape = any;
|
|
11
11
|
type ISelection = {
|
|
12
12
|
htmlElement: HTMLElement,
|
|
13
13
|
reactElement: CElement<any, any>,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
type IStore = {
|
|
17
17
|
htmlElement: HTMLElement,
|
|
18
18
|
reactElement: CElement<any, any>,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
type
|
|
21
|
+
type ISubject = {
|
|
22
22
|
htmlElement: HTMLElement
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -26,11 +26,17 @@ export default <ITestShape extends ITTestShape>(
|
|
|
26
26
|
testImplementations: ITestImplementation<
|
|
27
27
|
InitialState,
|
|
28
28
|
ISelection,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
IWhenShape,
|
|
30
|
+
IThenShape,
|
|
31
31
|
ITestShape
|
|
32
32
|
>,
|
|
33
|
-
testSpecifications: ITestSpecification<
|
|
33
|
+
testSpecifications: ITestSpecification<
|
|
34
|
+
ITestShape,
|
|
35
|
+
ISubject,
|
|
36
|
+
IStore,
|
|
37
|
+
ISelection,
|
|
38
|
+
IThenShape
|
|
39
|
+
>,
|
|
34
40
|
testInput: IInput
|
|
35
41
|
) => {
|
|
36
42
|
class TesterantoComponent extends testInput {
|
|
@@ -48,11 +54,11 @@ export default <ITestShape extends ITTestShape>(
|
|
|
48
54
|
return Testeranto<
|
|
49
55
|
ITestShape,
|
|
50
56
|
IInput,
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
ISubject,
|
|
58
|
+
IStore,
|
|
53
59
|
ISelection,
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
IThenShape,
|
|
61
|
+
IWhenShape,
|
|
56
62
|
InitialState
|
|
57
63
|
>(
|
|
58
64
|
testInput,
|
|
@@ -62,7 +68,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
62
68
|
beforeAll: async (
|
|
63
69
|
prototype,
|
|
64
70
|
artificer
|
|
65
|
-
): Promise<
|
|
71
|
+
): Promise<ISubject> => {
|
|
66
72
|
return await new Promise((resolve, rej) => {
|
|
67
73
|
document.addEventListener("DOMContentLoaded", function () {
|
|
68
74
|
const elem = document.getElementById("root");
|
|
@@ -77,7 +83,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
77
83
|
ndx,
|
|
78
84
|
testRsource,
|
|
79
85
|
artificer
|
|
80
|
-
): Promise<
|
|
86
|
+
): Promise<IStore> => {
|
|
81
87
|
return new Promise((resolve, rej) => {
|
|
82
88
|
const reactElement = React.createElement(TesterantoComponent, {
|
|
83
89
|
done: (reactElement) => {
|
|
@@ -92,20 +98,20 @@ export default <ITestShape extends ITTestShape>(
|
|
|
92
98
|
ReactDom.createRoot(htmlElement).render(reactElement);
|
|
93
99
|
});
|
|
94
100
|
},
|
|
95
|
-
andWhen: function (s:
|
|
101
|
+
andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
96
102
|
return actioner()(s);
|
|
97
103
|
},
|
|
98
|
-
butThen: async function (s:
|
|
104
|
+
butThen: async function (s: IStore): Promise<ISelection> {
|
|
99
105
|
return s;
|
|
100
106
|
},
|
|
101
107
|
afterEach: async function (
|
|
102
|
-
store:
|
|
108
|
+
store: IStore,
|
|
103
109
|
ndx,
|
|
104
110
|
artificer
|
|
105
111
|
) {
|
|
106
112
|
return {};
|
|
107
113
|
},
|
|
108
|
-
afterAll: (store:
|
|
114
|
+
afterAll: (store: IStore, artificer) => {
|
|
109
115
|
return;
|
|
110
116
|
},
|
|
111
117
|
},
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useEffect, useRef,
|
|
3
|
+
} from "react";
|
|
4
|
+
import ReactDom from "react-dom/client";
|
|
5
|
+
|
|
6
|
+
import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
|
|
7
|
+
import Testeranto from "../../../../src/Web";
|
|
8
|
+
|
|
9
|
+
type Input = [string, (string) => string, any];
|
|
10
|
+
type InitialState = unknown;
|
|
11
|
+
type IWhenShape = any;
|
|
12
|
+
type IThenShape = any;
|
|
13
|
+
type ISelection = IStore;
|
|
14
|
+
|
|
15
|
+
type Prototype = () => JSX.Element;
|
|
16
|
+
type IStore = {
|
|
17
|
+
root: HTMLElement,
|
|
18
|
+
react: HTMLElement,
|
|
19
|
+
};
|
|
20
|
+
type ISubject = {
|
|
21
|
+
root: HTMLElement
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default <ITestShape extends ITTestShape>(
|
|
25
|
+
testImplementations: ITestImplementation<
|
|
26
|
+
InitialState,
|
|
27
|
+
ISelection,
|
|
28
|
+
IWhenShape,
|
|
29
|
+
IThenShape,
|
|
30
|
+
ITestShape
|
|
31
|
+
>,
|
|
32
|
+
testSpecifications: ITestSpecification<
|
|
33
|
+
ITestShape,
|
|
34
|
+
ISubject,
|
|
35
|
+
IStore,
|
|
36
|
+
ISelection,
|
|
37
|
+
IThenShape
|
|
38
|
+
>,
|
|
39
|
+
testInput: Prototype
|
|
40
|
+
) => {
|
|
41
|
+
const TesterantoComponent = function (props) {
|
|
42
|
+
const myContainer = useRef(null);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
console.log(
|
|
46
|
+
"This only happens ONCE. It happens AFTER the initial render."
|
|
47
|
+
);
|
|
48
|
+
// eslint-disable-next-line react/prop-types
|
|
49
|
+
props.done(myContainer.current);
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
return React.createElement('div', { ref: myContainer }, testInput()); //testInput();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return Testeranto<
|
|
56
|
+
ITestShape,
|
|
57
|
+
Prototype,
|
|
58
|
+
ISubject,
|
|
59
|
+
IStore,
|
|
60
|
+
ISelection,
|
|
61
|
+
IThenShape,
|
|
62
|
+
IWhenShape,
|
|
63
|
+
InitialState
|
|
64
|
+
>(
|
|
65
|
+
testInput,
|
|
66
|
+
testSpecifications,
|
|
67
|
+
testImplementations,
|
|
68
|
+
{
|
|
69
|
+
beforeAll: async (
|
|
70
|
+
prototype,
|
|
71
|
+
artificer
|
|
72
|
+
): Promise<ISubject> => {
|
|
73
|
+
artificer("./before.txt", "hello artificer");
|
|
74
|
+
return await new Promise((resolve, rej) => {
|
|
75
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
76
|
+
const elem = document.getElementById("root");
|
|
77
|
+
if (elem) {
|
|
78
|
+
resolve({ root: elem });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
beforeEach: async (
|
|
84
|
+
{ root },
|
|
85
|
+
ndx,
|
|
86
|
+
testRsource,
|
|
87
|
+
artificer
|
|
88
|
+
): Promise<IStore> => {
|
|
89
|
+
return new Promise((resolve, rej) => {
|
|
90
|
+
ReactDom.createRoot(root).
|
|
91
|
+
render(
|
|
92
|
+
React.createElement(
|
|
93
|
+
TesterantoComponent, {
|
|
94
|
+
done: (react) => resolve({ root, react })
|
|
95
|
+
}, []));
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
andWhen: function (s: IStore, actioner): Promise<ISelection> {
|
|
99
|
+
return actioner()(s);
|
|
100
|
+
},
|
|
101
|
+
butThen: async function (s: IStore): Promise<ISelection> {
|
|
102
|
+
return s;
|
|
103
|
+
},
|
|
104
|
+
afterEach: async function (
|
|
105
|
+
store: IStore,
|
|
106
|
+
ndx,
|
|
107
|
+
artificer
|
|
108
|
+
) {
|
|
109
|
+
return {};
|
|
110
|
+
},
|
|
111
|
+
afterAll: (store: IStore, artificer) => {
|
|
112
|
+
// store.page.browser().close();
|
|
113
|
+
return;
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
)
|
|
117
|
+
};
|
|
@@ -6,36 +6,42 @@ import { ITestImplementation, ITestSpecification, ITTestShape } from "../../../c
|
|
|
6
6
|
|
|
7
7
|
export type IInput = typeof React.Component;
|
|
8
8
|
export type InitialState = unknown;
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
9
|
+
export type IWhenShape = any;
|
|
10
|
+
export type IThenShape = any;
|
|
11
11
|
export type ISelection = {
|
|
12
12
|
htmlElement: HTMLElement,
|
|
13
13
|
reactElement: CElement<any, any>,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type IStore = {
|
|
17
17
|
htmlElement: HTMLElement,
|
|
18
18
|
reactElement: CElement<any, any>,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type ISubject = {
|
|
22
22
|
htmlElement: HTMLElement
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export { };
|
|
26
26
|
export const ReactTestRendererTesteranto = <
|
|
27
27
|
ITestShape extends ITTestShape,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
IPropShape,
|
|
29
|
+
IStateShape
|
|
30
30
|
>(
|
|
31
31
|
testImplementations: ITestImplementation<
|
|
32
|
-
|
|
32
|
+
IPropShape,
|
|
33
33
|
renderer.ReactTestRenderer,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
IWhenShape,
|
|
35
|
+
IThenShape,
|
|
36
36
|
ITestShape
|
|
37
37
|
>,
|
|
38
|
-
testSpecifications: ITestSpecification<
|
|
38
|
+
testSpecifications: ITestSpecification<
|
|
39
|
+
ITestShape,
|
|
40
|
+
ISubject,
|
|
41
|
+
IStore,
|
|
42
|
+
ISelection,
|
|
43
|
+
IThenShape
|
|
44
|
+
>,
|
|
39
45
|
testInput: IInput,
|
|
40
46
|
) =>
|
|
41
47
|
Testeranto<
|
|
@@ -6,19 +6,19 @@ import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../c
|
|
|
6
6
|
|
|
7
7
|
export type IInput = typeof React.Component;
|
|
8
8
|
export type InitialState = unknown;
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
9
|
+
export type IWhenShape = any;
|
|
10
|
+
export type IThenShape = any;
|
|
11
11
|
export type ISelection = {
|
|
12
12
|
htmlElement: HTMLElement,
|
|
13
13
|
reactElement: CElement<any, any>,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type IStore = {
|
|
17
17
|
htmlElement: HTMLElement,
|
|
18
18
|
reactElement: CElement<any, any>,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type ISubject = {
|
|
22
22
|
htmlElement: HTMLElement
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -26,17 +26,23 @@ export { };
|
|
|
26
26
|
|
|
27
27
|
export const ReactTestRendererTesteranto = <
|
|
28
28
|
ITestShape extends ITTestShape,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
IPropShape,
|
|
30
|
+
IStateShape
|
|
31
31
|
>(
|
|
32
32
|
testImplementations: ITestImplementation<
|
|
33
|
-
|
|
33
|
+
IPropShape,
|
|
34
34
|
renderer.ReactTestRenderer,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
IWhenShape,
|
|
36
|
+
IThenShape,
|
|
37
37
|
ITestShape
|
|
38
38
|
>,
|
|
39
|
-
testSpecifications: ITestSpecification<
|
|
39
|
+
testSpecifications: ITestSpecification<
|
|
40
|
+
ITestShape,
|
|
41
|
+
ISubject,
|
|
42
|
+
IStore,
|
|
43
|
+
ISelection,
|
|
44
|
+
IThenShape
|
|
45
|
+
>,
|
|
40
46
|
testInput: IInput,
|
|
41
47
|
) =>
|
|
42
48
|
Testeranto<
|