testeranto 0.62.0 → 0.73.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/README.md +38 -26
- package/dist/cjs-shim.js +2 -2
- package/dist/common/Node.js +14 -51
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +121 -266
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/common/Types.js +2 -32
- package/dist/common/Web.js +25 -37
- package/dist/common/esbuildConfigs/index.js +5 -5
- package/dist/common/esbuildConfigs/node.js +17 -15
- package/dist/common/esbuildConfigs/report.js +12 -47
- package/dist/common/esbuildConfigs/tests.js +0 -1
- package/dist/common/esbuildConfigs/web.js +17 -12
- package/dist/common/lib/abstractBase.js +190 -35
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +42 -17
- package/dist/common/lib/index.js +11 -8
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +14 -28
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -51
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +122 -267
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-dom/component/node.js +2 -2
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/module/Types.js +3 -30
- package/dist/module/Web.js +26 -38
- package/dist/module/esbuildConfigs/index.js +5 -5
- package/dist/module/esbuildConfigs/node.js +17 -15
- package/dist/module/esbuildConfigs/report.js +11 -48
- package/dist/module/esbuildConfigs/tests.js +0 -1
- package/dist/module/esbuildConfigs/web.js +17 -12
- package/dist/module/lib/abstractBase.js +190 -35
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +44 -19
- package/dist/module/lib/index.js +11 -8
- package/dist/module/preload.js +15 -27
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/Node.d.ts +3 -2
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Project.d.ts +1 -2
- package/dist/types/Puppeteer.d.ts +1 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/puppeteer.d.ts +3 -3
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
- 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 +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/Types.d.ts +19 -100
- package/dist/types/Web.d.ts +3 -2
- package/dist/types/esbuildConfigs/features.d.ts +1 -1
- package/dist/types/esbuildConfigs/index.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +26 -24
- package/dist/types/lib/basebuilder.d.ts +10 -7
- package/dist/types/lib/classBuilder.d.ts +4 -3
- package/dist/types/lib/core.d.ts +5 -4
- package/dist/types/lib/index.d.ts +7 -5
- package/dist/types/lib/types.d.ts +62 -0
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/Node.ts +30 -85
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +183 -619
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +19 -14
- package/src/SubPackages/react/component/node.ts +20 -32
- package/src/SubPackages/react/component/web.ts +20 -30
- package/src/SubPackages/react/jsx/index.ts +13 -24
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react/jsx/web.ts +10 -8
- package/src/SubPackages/react-dom/component/node.ts +17 -23
- package/src/SubPackages/react-dom/component/web.ts +134 -95
- package/src/SubPackages/react-dom/jsx/web.ts +41 -48
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
- package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
- package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
- package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
- package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
- package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
- package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
- package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
- package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
- package/src/Types.ts +73 -307
- package/src/Web.ts +40 -81
- package/src/cjs-shim.js +2 -2
- package/src/esbuildConfigs/features.ts +3 -4
- package/src/esbuildConfigs/index.ts +8 -8
- package/src/esbuildConfigs/node.ts +21 -20
- package/src/esbuildConfigs/report.ts +15 -51
- package/src/esbuildConfigs/tests.ts +3 -9
- package/src/esbuildConfigs/web.ts +22 -20
- package/src/lib/abstractBase.ts +312 -164
- package/src/lib/basebuilder.ts +123 -127
- package/src/lib/classBuilder.ts +30 -48
- package/src/lib/core.ts +115 -84
- package/src/lib/index.ts +58 -56
- package/src/lib/types.ts +197 -0
- package/src/preload.ts +14 -30
- package/src/puppeteerConfiger.ts +26 -0
- package/src/web.html.ts +1 -1
- package/dist/common/NodeWriter.js +0 -56
- package/dist/common/electron.js +0 -196
- package/dist/common/lib/browser.js +0 -26
- package/dist/common/nodeWriterElectron.js +0 -55
- package/dist/module/NodeWriter.js +0 -50
- package/dist/module/electron.js +0 -191
- package/dist/module/lib/browser.js +0 -22
- package/dist/module/nodeWriterElectron.js +0 -52
- package/dist/types/NodeWriter.d.ts +0 -2
- package/dist/types/lib/browser.d.ts +0 -6
- package/dist/types/nodeWriterElectron.d.ts +0 -2
- package/src/NodeWriter.ts +0 -69
- package/src/electron.ts +0 -250
- package/src/lib/browser.ts +0 -34
- package/src/nodeWriterElectron.ts +0 -71
- package/yarn-error.log +0 -3144
- /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
|
@@ -1,60 +1,50 @@
|
|
|
1
|
-
import React, { useEffect, useRef
|
|
2
|
-
import { createPortal } from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
3
|
|
|
4
4
|
import Testeranto from "../../../Web.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
6
10
|
|
|
7
|
-
import type {
|
|
8
|
-
IInput,
|
|
9
|
-
ISelection,
|
|
10
|
-
IStore,
|
|
11
|
-
} from "./index";
|
|
11
|
+
import type { IInput, ISelection, IStore } from "./index";
|
|
12
12
|
|
|
13
13
|
export type ISubject = HTMLElement;
|
|
14
14
|
|
|
15
15
|
export default <ITestShape extends IBaseTest>(
|
|
16
|
-
testImplementations: ITestImplementation<
|
|
17
|
-
|
|
18
|
-
object
|
|
19
|
-
>,
|
|
20
|
-
testSpecifications: ITestSpecification<
|
|
21
|
-
ITestShape
|
|
22
|
-
>,
|
|
16
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
17
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
23
18
|
testInput: IInput
|
|
24
19
|
) => {
|
|
25
20
|
document.addEventListener("DOMContentLoaded", function () {
|
|
26
21
|
const rootElement = document.getElementById("root");
|
|
27
22
|
if (rootElement) {
|
|
28
|
-
const TesterantoComponent = function ({
|
|
23
|
+
const TesterantoComponent = function ({
|
|
24
|
+
done,
|
|
25
|
+
innerComp,
|
|
26
|
+
}: {
|
|
27
|
+
done: (ref: React.MutableRefObject<any>) => any;
|
|
28
|
+
innerComp: IInput;
|
|
29
|
+
}) {
|
|
29
30
|
const myContainer = useRef<any>(null);
|
|
30
31
|
useEffect(() => {
|
|
31
|
-
console.log(
|
|
32
|
-
"useEffect called", myContainer.current
|
|
33
|
-
);
|
|
32
|
+
console.log("useEffect called", myContainer.current);
|
|
34
33
|
done(myContainer.current);
|
|
35
34
|
}, []);
|
|
36
35
|
|
|
37
|
-
return React.createElement(
|
|
38
|
-
'div',
|
|
39
|
-
{ ref: myContainer },
|
|
40
|
-
innerComp()
|
|
41
|
-
);
|
|
36
|
+
return React.createElement("div", { ref: myContainer }, innerComp());
|
|
42
37
|
};
|
|
43
38
|
|
|
44
|
-
Testeranto<
|
|
45
|
-
ITestShape
|
|
46
|
-
>(
|
|
39
|
+
Testeranto<ITestShape>(
|
|
47
40
|
testInput,
|
|
48
41
|
testSpecifications,
|
|
49
42
|
testImplementations,
|
|
50
43
|
{
|
|
51
|
-
beforeAll: async (
|
|
52
|
-
input,
|
|
53
|
-
artificer
|
|
54
|
-
): Promise<HTMLElement> => {
|
|
44
|
+
beforeAll: async (input, artificer): Promise<HTMLElement> => {
|
|
55
45
|
return await new Promise((resolve, rej) => {
|
|
56
46
|
resolve(rootElement);
|
|
57
|
-
})
|
|
47
|
+
});
|
|
58
48
|
},
|
|
59
49
|
|
|
60
50
|
beforeEach: async (
|
|
@@ -69,41 +59,44 @@ export default <ITestShape extends IBaseTest>(
|
|
|
69
59
|
innerComp: testInput,
|
|
70
60
|
done: (reactElement: any) => {
|
|
71
61
|
process.nextTick(() => {
|
|
72
|
-
resolve(reactElement)
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
),
|
|
62
|
+
resolve(reactElement);
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
77
66
|
rootElement
|
|
78
67
|
);
|
|
79
68
|
});
|
|
80
69
|
},
|
|
81
70
|
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
82
71
|
return new Promise((resolve, rej) => {
|
|
83
|
-
process.nextTick(() => {
|
|
72
|
+
process.nextTick(() => {
|
|
73
|
+
resolve(whenCB()(s));
|
|
74
|
+
});
|
|
84
75
|
});
|
|
85
76
|
},
|
|
86
77
|
butThen: async function (s: IStore): Promise<ISelection> {
|
|
87
78
|
return new Promise((resolve, rej) => {
|
|
88
|
-
process.nextTick(() => {
|
|
79
|
+
process.nextTick(() => {
|
|
80
|
+
resolve(s);
|
|
81
|
+
});
|
|
89
82
|
});
|
|
90
83
|
},
|
|
91
|
-
afterEach: async function (
|
|
92
|
-
store: IStore,
|
|
93
|
-
ndx,
|
|
94
|
-
artificer
|
|
95
|
-
) {
|
|
84
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
96
85
|
return new Promise((resolve, rej) => {
|
|
97
|
-
process.nextTick(() => {
|
|
86
|
+
process.nextTick(() => {
|
|
87
|
+
resolve({});
|
|
88
|
+
});
|
|
98
89
|
});
|
|
99
90
|
},
|
|
100
91
|
afterAll: (store: IStore, artificer) => {
|
|
101
92
|
return new Promise((resolve, rej) => {
|
|
102
|
-
process.nextTick(() => {
|
|
93
|
+
process.nextTick(() => {
|
|
94
|
+
resolve({});
|
|
95
|
+
});
|
|
103
96
|
});
|
|
104
97
|
},
|
|
105
|
-
}
|
|
106
|
-
)
|
|
98
|
+
}
|
|
99
|
+
);
|
|
107
100
|
}
|
|
108
101
|
});
|
|
109
102
|
};
|
|
@@ -1,48 +1,38 @@
|
|
|
1
|
-
import test from "../../../Node";
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import renderer, { act } from "react-test-renderer";
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IBaseTest,
|
|
6
|
+
ITestImplementation,
|
|
7
|
+
ITestSpecification,
|
|
8
|
+
} from "../../../Types";
|
|
9
|
+
import test from "../../../Node";
|
|
7
10
|
|
|
8
11
|
type IInput = React.MemoExoticComponent<() => JSX.Element>;
|
|
9
12
|
type WhenShape = unknown;
|
|
10
13
|
type ThenShape = unknown;
|
|
11
14
|
|
|
12
15
|
export default <ITestShape extends IBaseTest, PropShape>(
|
|
13
|
-
testImplementations: ITestImplementation<
|
|
14
|
-
|
|
15
|
-
>,
|
|
16
|
-
testSpecifications: ITestSpecification<
|
|
17
|
-
ITestShape
|
|
18
|
-
>,
|
|
16
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
17
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
19
18
|
testInput: IInput
|
|
20
19
|
) =>
|
|
21
|
-
test<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
andWhen: async function (
|
|
41
|
-
renderer: renderer.ReactTestRenderer,
|
|
42
|
-
whenCB: () => (a: any) => any
|
|
43
|
-
): Promise<renderer.ReactTestRenderer> {
|
|
44
|
-
await act(() => whenCB()(renderer));
|
|
45
|
-
return renderer;
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
);
|
|
20
|
+
test<ITestShape>(testInput, testSpecifications, testImplementations, {
|
|
21
|
+
beforeEach: function (
|
|
22
|
+
CComponent,
|
|
23
|
+
props
|
|
24
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
25
|
+
let component;
|
|
26
|
+
act(() => {
|
|
27
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
28
|
+
});
|
|
29
|
+
return component;
|
|
30
|
+
},
|
|
31
|
+
andWhen: async function (
|
|
32
|
+
renderer: renderer.ReactTestRenderer,
|
|
33
|
+
whenCB: () => (a: any) => any
|
|
34
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
35
|
+
await act(() => whenCB()(renderer));
|
|
36
|
+
return renderer;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -2,7 +2,9 @@ import React from "react";
|
|
|
2
2
|
import renderer, { act } from "react-test-renderer";
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
-
IBaseTest,
|
|
5
|
+
IBaseTest,
|
|
6
|
+
ITestImplementation,
|
|
7
|
+
ITestSpecification,
|
|
6
8
|
} from "../../../Types";
|
|
7
9
|
|
|
8
10
|
export type ISuper<T> = T extends infer U ? U : object;
|
|
@@ -15,17 +17,10 @@ export type ISelection = renderer.ReactTestRenderer;
|
|
|
15
17
|
export type IStore = renderer.ReactTestRenderer;
|
|
16
18
|
export type ISubject = renderer.ReactTestRenderer;
|
|
17
19
|
|
|
18
|
-
export type IImpl<
|
|
19
|
-
ITestShape
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
ITestShape, object
|
|
23
|
-
>
|
|
24
|
-
export type ISpec<
|
|
25
|
-
ITestShape extends IBaseTest
|
|
26
|
-
> = ITestSpecification<
|
|
27
|
-
ITestShape
|
|
28
|
-
>
|
|
20
|
+
export type IImpl<ITestShape extends IBaseTest> =
|
|
21
|
+
ITestImplementation<ITestShape>;
|
|
22
|
+
export type ISpec<ITestShape extends IBaseTest> =
|
|
23
|
+
ITestSpecification<ITestShape>;
|
|
29
24
|
|
|
30
25
|
// export const testInterface = {
|
|
31
26
|
// beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
|
|
@@ -48,11 +43,11 @@ export type ISpec<
|
|
|
48
43
|
// }
|
|
49
44
|
// }
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
53
46
|
export const testInterface = {
|
|
54
|
-
beforeEach: function (
|
|
55
|
-
|
|
47
|
+
beforeEach: function (
|
|
48
|
+
CComponent,
|
|
49
|
+
propsAndChildren
|
|
50
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
56
51
|
function Link(props) {
|
|
57
52
|
const p = props.props;
|
|
58
53
|
const c = props.children;
|
|
@@ -73,31 +68,22 @@ export const testInterface = {
|
|
|
73
68
|
): Promise<renderer.ReactTestRenderer> {
|
|
74
69
|
// console.log("andWhen", whenCB)
|
|
75
70
|
await act(() => whenCB(renderer));
|
|
76
|
-
return renderer
|
|
71
|
+
return renderer;
|
|
77
72
|
},
|
|
78
73
|
|
|
79
74
|
// andWhen: function (s: Store, whenCB): Promise<Selection> {
|
|
80
75
|
// return whenCB()(s);
|
|
81
76
|
// },
|
|
82
77
|
butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
|
|
83
|
-
|
|
84
|
-
console.log("butThen", thenCB.toString())
|
|
85
|
-
// debugger
|
|
78
|
+
console.log("butThen", thenCB.toString());
|
|
86
79
|
return thenCB(s);
|
|
87
80
|
},
|
|
88
|
-
afterEach: async function (
|
|
89
|
-
store: IStore,
|
|
90
|
-
ndx,
|
|
91
|
-
artificer
|
|
92
|
-
) {
|
|
81
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
93
82
|
// console.log("afterEach", store);
|
|
94
|
-
return {
|
|
95
|
-
|
|
96
|
-
};
|
|
83
|
+
return {};
|
|
97
84
|
},
|
|
98
85
|
afterAll: (store: IStore, artificer) => {
|
|
99
86
|
// console.log("afterAll", store);
|
|
100
87
|
return;
|
|
101
88
|
},
|
|
102
|
-
|
|
103
|
-
}
|
|
89
|
+
};
|
|
@@ -3,20 +3,14 @@ import type { IBaseTest } from "../../../Types";
|
|
|
3
3
|
|
|
4
4
|
import { IImpl, ISpec, IInput, testInterface } from "./index.js";
|
|
5
5
|
|
|
6
|
-
export default <
|
|
7
|
-
ITestShape
|
|
8
|
-
IProps,
|
|
9
|
-
IState
|
|
10
|
-
>(
|
|
11
|
-
testImplementations: IImpl<ITestShape, object>,
|
|
6
|
+
export default <ITestShape extends IBaseTest, IProps, IState>(
|
|
7
|
+
testImplementations: IImpl<ITestShape>,
|
|
12
8
|
testSpecifications: ISpec<ITestShape>,
|
|
13
|
-
testInput: IInput<IProps, IState
|
|
9
|
+
testInput: IInput<IProps, IState>
|
|
14
10
|
) =>
|
|
15
|
-
Testeranto<
|
|
16
|
-
ITestShape
|
|
17
|
-
>(
|
|
11
|
+
Testeranto<ITestShape>(
|
|
18
12
|
testInput,
|
|
19
13
|
testSpecifications,
|
|
20
14
|
testImplementations,
|
|
21
15
|
testInterface
|
|
22
|
-
)
|
|
16
|
+
);
|
|
@@ -3,20 +3,14 @@ import Testeranto from "../../../Web.js";
|
|
|
3
3
|
|
|
4
4
|
import { IImpl, ISpec, IInput, testInterface } from "./index.js";
|
|
5
5
|
|
|
6
|
-
export default <
|
|
7
|
-
ITestShape
|
|
8
|
-
IProps,
|
|
9
|
-
IState
|
|
10
|
-
>(
|
|
11
|
-
testImplementations: IImpl<ITestShape, object>,
|
|
6
|
+
export default <ITestShape extends IBaseTest, IProps, IState>(
|
|
7
|
+
testImplementations: IImpl<ITestShape>,
|
|
12
8
|
testSpecifications: ISpec<ITestShape>,
|
|
13
|
-
testInput: IInput<any, any
|
|
9
|
+
testInput: IInput<any, any>
|
|
14
10
|
) =>
|
|
15
|
-
Testeranto<
|
|
16
|
-
ITestShape
|
|
17
|
-
>(
|
|
11
|
+
Testeranto<ITestShape>(
|
|
18
12
|
testInput,
|
|
19
13
|
testSpecifications,
|
|
20
14
|
testImplementations,
|
|
21
15
|
testInterface
|
|
22
|
-
)
|
|
16
|
+
);
|
|
@@ -3,61 +3,47 @@ import renderer, { act } from "react-test-renderer";
|
|
|
3
3
|
|
|
4
4
|
import test from "../../../Node.js";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ITestSpecification,
|
|
8
|
+
ITestImplementation,
|
|
9
|
+
IBaseTest,
|
|
10
|
+
} from "../../../Types";
|
|
7
11
|
|
|
8
12
|
export type IInput = React.FC;
|
|
9
13
|
export type IWhenShape = unknown;
|
|
10
14
|
export type IThenShape = unknown;
|
|
11
15
|
|
|
12
|
-
export type ISpec<ITestShape extends IBaseTest> =
|
|
13
|
-
ITestShape
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
ITestShape extends IBaseTest
|
|
17
|
-
>(
|
|
18
|
-
testImplementations: ITestImplementation<
|
|
19
|
-
ITestShape, object
|
|
20
|
-
>,
|
|
16
|
+
export type ISpec<ITestShape extends IBaseTest> =
|
|
17
|
+
ITestSpecification<ITestShape>;
|
|
18
|
+
export default <ITestShape extends IBaseTest>(
|
|
19
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
21
20
|
testSpecifications: ISpec<ITestShape>,
|
|
22
21
|
testInput: IInput
|
|
23
22
|
) =>
|
|
24
|
-
test<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
andWhen: async function (
|
|
52
|
-
renderer: renderer.ReactTestRenderer,
|
|
53
|
-
whenCB: () => (a: any) => any
|
|
54
|
-
): Promise<renderer.ReactTestRenderer> {
|
|
55
|
-
await act(() => whenCB()(renderer));
|
|
56
|
-
return renderer;
|
|
57
|
-
},
|
|
58
|
-
afterEach: async (store, key, artificer) => {
|
|
59
|
-
console.log("afterall")
|
|
60
|
-
store.unmount();
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
);
|
|
23
|
+
test<ITestShape>(testInput, testSpecifications, testImplementations, {
|
|
24
|
+
beforeEach: function (
|
|
25
|
+
CComponent,
|
|
26
|
+
props
|
|
27
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
28
|
+
return new Promise((res, rej) => {
|
|
29
|
+
let component: renderer.ReactTestRenderer;
|
|
30
|
+
act(() => {
|
|
31
|
+
component = renderer.create(
|
|
32
|
+
React.createElement(CComponent, props, [])
|
|
33
|
+
);
|
|
34
|
+
res(component);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
andWhen: async function (
|
|
39
|
+
renderer: renderer.ReactTestRenderer,
|
|
40
|
+
whenCB: () => (a: any) => any
|
|
41
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
42
|
+
await act(() => whenCB()(renderer));
|
|
43
|
+
return renderer;
|
|
44
|
+
},
|
|
45
|
+
afterEach: async (store, key, artificer) => {
|
|
46
|
+
console.log("afterall");
|
|
47
|
+
store.unmount();
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
import test from "../../../Web.js";
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import renderer, { act } from "react-test-renderer";
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ITestSpecification,
|
|
6
|
+
ITestImplementation,
|
|
7
|
+
IBaseTest,
|
|
8
|
+
} from "../../../Types";
|
|
9
|
+
import test from "../../../Web.js";
|
|
7
10
|
|
|
8
11
|
export type IInput = React.FC;
|
|
9
12
|
export type IWhenShape = unknown;
|
|
10
13
|
export type IThenShape = unknown;
|
|
11
14
|
|
|
12
|
-
export type ISpec<ITestShape extends IBaseTest> =
|
|
13
|
-
ITestShape
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
ITestShape extends IBaseTest,
|
|
17
|
-
IPropShape
|
|
18
|
-
>(
|
|
19
|
-
testImplementations: ITestImplementation<
|
|
20
|
-
ITestShape, object
|
|
21
|
-
>,
|
|
15
|
+
export type ISpec<ITestShape extends IBaseTest> =
|
|
16
|
+
ITestSpecification<ITestShape>;
|
|
17
|
+
export default <ITestShape extends IBaseTest, IPropShape>(
|
|
18
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
22
19
|
testSpecifications: ISpec<ITestShape>,
|
|
23
20
|
testInput: IInput
|
|
24
21
|
) =>
|
|
25
|
-
test<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
): Promise<renderer.ReactTestRenderer> {
|
|
53
|
-
await act(() => whenCB()(renderer));
|
|
54
|
-
return renderer;
|
|
55
|
-
},
|
|
56
|
-
afterEach: async (store, key, artificer) => {
|
|
57
|
-
console.log("afterall")
|
|
58
|
-
store.unmount();
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
);
|
|
22
|
+
test<ITestShape>(testInput, testSpecifications, testImplementations, {
|
|
23
|
+
beforeEach: function (
|
|
24
|
+
CComponent,
|
|
25
|
+
props
|
|
26
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
27
|
+
return new Promise((res, rej) => {
|
|
28
|
+
let component: renderer.ReactTestRenderer;
|
|
29
|
+
act(() => {
|
|
30
|
+
component = renderer.create(
|
|
31
|
+
React.createElement(CComponent, props, [])
|
|
32
|
+
);
|
|
33
|
+
res(component);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
andWhen: async function (
|
|
38
|
+
renderer: renderer.ReactTestRenderer,
|
|
39
|
+
whenCB: () => (a: any) => any
|
|
40
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
41
|
+
await act(() => whenCB()(renderer));
|
|
42
|
+
return renderer;
|
|
43
|
+
},
|
|
44
|
+
afterEach: async (store, key, artificer) => {
|
|
45
|
+
console.log("afterall");
|
|
46
|
+
store.unmount();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -4,7 +4,7 @@ import renderer, { act } from "react-test-renderer";
|
|
|
4
4
|
import {
|
|
5
5
|
IBaseTest,
|
|
6
6
|
ITestImplementation,
|
|
7
|
-
ITestSpecification
|
|
7
|
+
ITestSpecification,
|
|
8
8
|
} from "../../../Types";
|
|
9
9
|
|
|
10
10
|
export type IWhenShape = any;
|
|
@@ -15,32 +15,26 @@ export type ISelection = renderer.ReactTestRenderer;
|
|
|
15
15
|
export type IStore = renderer.ReactTestRenderer;
|
|
16
16
|
export type ISubject = renderer.ReactTestRenderer;
|
|
17
17
|
|
|
18
|
-
export type ITestImpl<
|
|
19
|
-
ITestShape
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
18
|
+
export type ITestImpl<ITestShape extends IBaseTest> = ITestImplementation<
|
|
19
|
+
ITestShape,
|
|
20
|
+
object
|
|
21
|
+
>;
|
|
23
22
|
|
|
24
|
-
export type ITestSpec<
|
|
25
|
-
ITestShape
|
|
26
|
-
> = ITestSpecification<
|
|
27
|
-
ITestShape
|
|
28
|
-
>
|
|
23
|
+
export type ITestSpec<ITestShape extends IBaseTest> =
|
|
24
|
+
ITestSpecification<ITestShape>;
|
|
29
25
|
|
|
30
26
|
export const testInterface = {
|
|
31
27
|
butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
|
|
32
|
-
|
|
33
|
-
console.log("butThen", thenCB.toString())
|
|
34
|
-
// debugger
|
|
28
|
+
console.log("butThen", thenCB.toString());
|
|
35
29
|
return thenCB(s);
|
|
36
30
|
},
|
|
37
|
-
beforeEach: function (
|
|
38
|
-
|
|
31
|
+
beforeEach: function (
|
|
32
|
+
CComponent,
|
|
33
|
+
props
|
|
34
|
+
): Promise<renderer.ReactTestRenderer> {
|
|
39
35
|
let component;
|
|
40
36
|
act(() => {
|
|
41
|
-
component = renderer.create(
|
|
42
|
-
React.createElement(CComponent, props, [])
|
|
43
|
-
);
|
|
37
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
44
38
|
});
|
|
45
39
|
return component;
|
|
46
40
|
},
|
|
@@ -49,6 +43,6 @@ export const testInterface = {
|
|
|
49
43
|
whenCB: (any) => any
|
|
50
44
|
): Promise<renderer.ReactTestRenderer> {
|
|
51
45
|
await act(() => whenCB(renderer));
|
|
52
|
-
return renderer
|
|
53
|
-
}
|
|
46
|
+
return renderer;
|
|
47
|
+
},
|
|
54
48
|
};
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import test from "../../../Node.js";
|
|
2
2
|
import { IBaseTest } from "../../../Types";
|
|
3
|
+
|
|
3
4
|
import type { ITestImpl, ITestSpec } from "../jsx-promised";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
IInput,
|
|
7
|
-
testInterface
|
|
8
|
-
} from "./index.js";
|
|
6
|
+
import { IInput, testInterface } from "./index.js";
|
|
9
7
|
|
|
10
8
|
export default <ITestShape extends IBaseTest>(
|
|
11
9
|
testImplementations: ITestImpl<ITestShape>,
|
|
12
10
|
testSpecifications: ITestSpec<ITestShape>,
|
|
13
11
|
testInput: IInput,
|
|
14
|
-
testInterface2 = testInterface
|
|
12
|
+
testInterface2 = testInterface
|
|
15
13
|
) => {
|
|
16
|
-
return test<
|
|
17
|
-
ITestShape
|
|
18
|
-
>(
|
|
14
|
+
return test<ITestShape>(
|
|
19
15
|
testInput,
|
|
20
16
|
testSpecifications,
|
|
21
17
|
testImplementations,
|
|
22
|
-
testInterface2
|
|
23
|
-
)
|
|
18
|
+
testInterface2
|
|
19
|
+
);
|
|
24
20
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { IInput, testInterface } from "./index.js";
|
|
2
1
|
import { IBaseTest } from "../../../Types";
|
|
3
2
|
import test from "../../../Web.js";
|
|
3
|
+
|
|
4
4
|
import { ITestImpl, ITestSpec } from "../jsx-promised";
|
|
5
5
|
|
|
6
|
+
import { IInput, testInterface } from "./index.js";
|
|
7
|
+
|
|
6
8
|
export default <ITestShape extends IBaseTest>(
|
|
7
9
|
testImplementations: ITestImpl<ITestShape>,
|
|
8
10
|
testSpecifications: ITestSpec<ITestShape>,
|
|
9
11
|
testInput: IInput,
|
|
10
|
-
testInterface2 = testInterface
|
|
12
|
+
testInterface2 = testInterface
|
|
11
13
|
) => {
|
|
12
|
-
return test<
|
|
13
|
-
ITestShape
|
|
14
|
-
>(
|
|
14
|
+
return test<ITestShape>(
|
|
15
15
|
testInput,
|
|
16
16
|
testSpecifications,
|
|
17
17
|
testImplementations,
|
|
18
|
-
testInterface2
|
|
19
|
-
)
|
|
18
|
+
testInterface2
|
|
19
|
+
);
|
|
20
20
|
};
|