testeranto 0.49.10 → 0.70.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/.nvmrc +1 -0
- package/README.md +92 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +37 -62
- package/dist/common/NodeWriter.js +7 -9
- package/dist/common/Project.js +130 -627
- package/dist/common/SubPackages/puppeteer.js +19 -0
- package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
- package/dist/common/SubPackages/react/jsx/index.js +13 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
- package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +19 -20
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -15
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
- package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
- package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -113
- package/dist/common/electron.js +256 -42
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/report.js +13 -0
- package/dist/common/esbuildConfigs/tests.js +13 -0
- package/dist/common/esbuildConfigs/web.js +53 -0
- package/dist/common/lib/abstractBase.js +200 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +81 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +15 -24
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/report.html.js +31 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/web.html.js +22 -0
- package/dist/module/Features.js +2 -3
- package/dist/module/Node.js +37 -62
- package/dist/module/NodeWriter.js +7 -9
- package/dist/module/Project.js +131 -605
- package/dist/module/SubPackages/puppeteer.js +14 -0
- package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
- package/dist/module/SubPackages/react/jsx/index.js +10 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +7 -7
- package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +20 -21
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -15
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +2 -0
- package/dist/module/Web.js +49 -113
- package/dist/module/electron.js +257 -43
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/report.js +11 -0
- package/dist/module/esbuildConfigs/tests.js +11 -0
- package/dist/module/esbuildConfigs/web.js +48 -0
- package/dist/module/lib/abstractBase.js +192 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +78 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/preload.js +12 -24
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/report.html.js +29 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/Report.css +10326 -0
- package/dist/prebuild/Report.js +37456 -0
- package/dist/types/Features.d.ts +5 -5
- package/dist/types/Node.d.ts +5 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -28
- package/dist/types/SubPackages/puppeteer.d.ts +6 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +49 -17
- package/dist/types/Web.d.ts +5 -11
- package/dist/types/esbuildConfigs/features.d.ts +4 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/lib/abstractBase.d.ts +103 -0
- package/dist/types/lib/basebuilder.d.ts +25 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +8 -0
- package/dist/types/lib/index.d.ts +58 -0
- package/dist/types/lib/types.d.ts +70 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/report.html.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/web.html.d.ts +2 -0
- package/electronBuild.ts +32 -0
- package/index.html +30 -0
- package/package.json +123 -87
- package/src/Features.ts +2 -4
- package/src/Node.ts +79 -155
- package/src/NodeWriter.ts +22 -22
- package/src/Project.ts +185 -783
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +51 -0
- package/src/SubPackages/react/component/node.ts +43 -0
- package/src/SubPackages/react/component/web.ts +43 -0
- package/src/SubPackages/react/jsx/index.ts +32 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +30 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
- package/src/SubPackages/react-dom/component/web.ts +104 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/SubPackages/react-dom/jsx/web.ts +102 -0
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
- package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
- package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
- package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
- package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
- package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
- package/src/Types.ts +114 -17
- package/src/Web.ts +100 -225
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +303 -45
- package/src/esbuildConfigs/features.ts +17 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +60 -0
- package/src/esbuildConfigs/report.ts +15 -0
- package/src/esbuildConfigs/tests.ts +14 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +412 -0
- package/src/lib/basebuilder.ts +228 -0
- package/src/lib/classBuilder.ts +118 -0
- package/src/lib/core.ts +214 -0
- package/src/lib/index.ts +117 -0
- package/src/lib/types.ts +206 -0
- package/src/preload.ts +13 -27
- package/src/puppeteerConfiger.ts +26 -0
- package/src/report.html.ts +29 -0
- package/src/web.html.ts +20 -0
- package/tests/Rectangle.test.ts +189 -0
- package/tsconfig.json +19 -6
- package/tsconfig.module.json +15 -4
- package/tsconfig.types.json +14 -4
- package/yarn-error.log +3144 -0
- package/dist/common/core.js +0 -397
- package/dist/common/subPackages/react/jsx/index.js +0 -26
- package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
- package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
- package/dist/module/Report.js +0 -186
- package/dist/module/core.js +0 -388
- package/dist/module/subPackages/react/jsx/index.js +0 -22
- package/dist/module/subPackages/react/jsx/node.js +0 -5
- package/dist/module/subPackages/react/jsx/web.js +0 -5
- package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/types/core.d.ts +0 -220
- package/dist/types/subPackages/react/component/node.d.ts +0 -12
- package/dist/types/subPackages/react/component/web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
- package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-dom/component/node.d.ts +0 -14
- package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/src/core.ts +0 -1399
- package/src/subPackages/react/component/node.ts +0 -75
- package/src/subPackages/react/component/web.ts +0 -80
- package/src/subPackages/react/jsx/index.ts +0 -64
- package/src/subPackages/react/jsx/node.ts +0 -29
- package/src/subPackages/react/jsx/web.ts +0 -29
- package/src/subPackages/react-dom/component/web.ts +0 -129
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-dom/jsx/web.ts +0 -145
- package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
- package/src/subPackages/react-test-renderer/component/node.ts +0 -30
- package/src/subPackages/react-test-renderer/component/web.ts +0 -30
- package/src/subPackages/react-test-renderer/fc/node.ts +0 -77
- package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
- package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
- package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
- /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
package/src/Report.tsx
CHANGED
|
@@ -10,8 +10,8 @@ import { Sigma, RandomizeNodePositions, RelativeSize } from 'react-sigma';
|
|
|
10
10
|
|
|
11
11
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { TesterantoFeatures } from "./Features.js";
|
|
14
|
+
import { ITestTypes } from "./lib/types.js";
|
|
15
15
|
|
|
16
16
|
type IGraphData = {
|
|
17
17
|
nodes: { id: string, label: string }[],
|
|
@@ -46,8 +46,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
|
46
46
|
|
|
47
47
|
const Report = () => {
|
|
48
48
|
const [tests, setTests] = useState<
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
{
|
|
50
|
+
tests: ITestTypes[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
>({
|
|
54
|
+
tests: []
|
|
55
|
+
});
|
|
51
56
|
const [features, setFeatures] = useState<TesterantoFeatures>(
|
|
52
57
|
new TesterantoFeatures({}, {
|
|
53
58
|
undirected: [],
|
|
@@ -57,21 +62,31 @@ const Report = () => {
|
|
|
57
62
|
);
|
|
58
63
|
|
|
59
64
|
useEffect(() => {
|
|
60
|
-
const
|
|
61
|
-
const module = await import('
|
|
62
|
-
|
|
65
|
+
const importFeatures = async () => {
|
|
66
|
+
const module = await import('features.test.js');
|
|
67
|
+
console.log("imported features", module.default);
|
|
68
|
+
setFeatures(module.default);
|
|
63
69
|
};
|
|
64
|
-
|
|
65
|
-
importTests();
|
|
70
|
+
importFeatures();
|
|
66
71
|
}, []);
|
|
67
72
|
|
|
73
|
+
|
|
68
74
|
useEffect(() => {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
|
|
75
|
+
const importTests = async () => {
|
|
76
|
+
const x = await fetch("./testeranto.json")
|
|
77
|
+
const y = await x.json();
|
|
78
|
+
console.log("imported tests", y);
|
|
79
|
+
setTests(y as any);
|
|
80
|
+
// const module = await import('tests.json', {
|
|
81
|
+
// with: {
|
|
82
|
+
// type: 'json'
|
|
83
|
+
// }
|
|
84
|
+
// });
|
|
85
|
+
// console.log("imported tests", module.default);
|
|
86
|
+
// setTests(module.default);
|
|
72
87
|
};
|
|
73
88
|
|
|
74
|
-
|
|
89
|
+
importTests();
|
|
75
90
|
}, []);
|
|
76
91
|
|
|
77
92
|
|
|
@@ -336,14 +351,14 @@ footer {
|
|
|
336
351
|
</Col>
|
|
337
352
|
<Col sm={6}>
|
|
338
353
|
<Tab.Content>
|
|
339
|
-
{tests.map((t, ndx) => {
|
|
354
|
+
{/* {tests.tests.map((t, ndx) => {
|
|
340
355
|
return (
|
|
341
356
|
<Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
|
|
342
357
|
<pre>{JSON.stringify(t, null, 2)}</pre>
|
|
343
358
|
</Tab.Pane>
|
|
344
359
|
)
|
|
345
360
|
}
|
|
346
|
-
)}
|
|
361
|
+
)} */}
|
|
347
362
|
</Tab.Content>
|
|
348
363
|
</Col>
|
|
349
364
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Testeranto from "../Node.js";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
IPartialNodeInterface,
|
|
8
|
+
ITestImplementation,
|
|
9
|
+
ITestSpecification,
|
|
10
|
+
} from "../Types";
|
|
11
|
+
|
|
12
|
+
type IInput = string;
|
|
13
|
+
type ISelection = any;
|
|
14
|
+
type IStore = any;
|
|
15
|
+
type ISubject = any;
|
|
16
|
+
|
|
17
|
+
export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec>;
|
|
18
|
+
|
|
19
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
20
|
+
|
|
21
|
+
export default <ITestShape extends IBaseTest>(
|
|
22
|
+
testInput: IInput,
|
|
23
|
+
testSpecifications: ISpec<ITestShape>,
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
25
|
+
testInterface?: IPartialNodeInterface<ITestShape>
|
|
26
|
+
) => {
|
|
27
|
+
return Testeranto<ITestShape>(
|
|
28
|
+
testInput,
|
|
29
|
+
testSpecifications,
|
|
30
|
+
testImplementations,
|
|
31
|
+
{
|
|
32
|
+
beforeAll(x) {
|
|
33
|
+
process.parentPort.postMessage(
|
|
34
|
+
`/docs/web/src/ClassicalComponent/test.html`
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return x;
|
|
38
|
+
},
|
|
39
|
+
beforeEach: async (): Promise<IStore> => {
|
|
40
|
+
return new Promise((resolve, rej) => {
|
|
41
|
+
resolve(React.createElement(testInput, {}, []));
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
45
|
+
return whenCB()(s);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
...testInterface,
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Testeranto from "../../../Node.js";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
10
|
+
|
|
11
|
+
type IInput = typeof React.Component;
|
|
12
|
+
type ISelection = React.CElement<any, any>;
|
|
13
|
+
type IStore = React.CElement<any, any>;
|
|
14
|
+
type ISubject = React.CElement<any, any>;
|
|
15
|
+
|
|
16
|
+
export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
|
|
17
|
+
ISpec,
|
|
18
|
+
object
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
22
|
+
|
|
23
|
+
export default <ITestShape extends IBaseTest, IState>(
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
25
|
+
testSpecifications: ISpec<ITestShape>,
|
|
26
|
+
testInput: IInput
|
|
27
|
+
) => {
|
|
28
|
+
return Testeranto<ITestShape>(
|
|
29
|
+
testInput,
|
|
30
|
+
testSpecifications,
|
|
31
|
+
testImplementations,
|
|
32
|
+
{
|
|
33
|
+
beforeEach: async (): Promise<IStore> => {
|
|
34
|
+
return new Promise((resolve, rej) => {
|
|
35
|
+
resolve(React.createElement(testInput, {}, []));
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
39
|
+
return whenCB()(s);
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Testeranto from "../../../Web.js";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
10
|
+
|
|
11
|
+
type IInput = typeof React.Component;
|
|
12
|
+
type ISelection = React.CElement<any, any>;
|
|
13
|
+
type Store = React.CElement<any, any>;
|
|
14
|
+
// type Subject = React.CElement<any, any>;
|
|
15
|
+
|
|
16
|
+
export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
|
|
17
|
+
ISpec,
|
|
18
|
+
object
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
22
|
+
|
|
23
|
+
export default <ITestShape extends IBaseTest>(
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
25
|
+
testSpecifications: ISpec<ITestShape>,
|
|
26
|
+
testInput: IInput
|
|
27
|
+
) => {
|
|
28
|
+
return Testeranto<ITestShape>(
|
|
29
|
+
testInput,
|
|
30
|
+
testSpecifications,
|
|
31
|
+
testImplementations,
|
|
32
|
+
{
|
|
33
|
+
beforeEach: async (): Promise<Store> => {
|
|
34
|
+
return new Promise((resolve, rej) => {
|
|
35
|
+
resolve(React.createElement(testInput, {}, []));
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
andWhen: function (s: Store, whenCB): Promise<ISelection> {
|
|
39
|
+
return whenCB()(s);
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CElement } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
IBaseTest,
|
|
5
|
+
ITestImplementation,
|
|
6
|
+
ITestSpecification,
|
|
7
|
+
} from "../../../Types";
|
|
8
|
+
|
|
9
|
+
export type IWhenShape = any;
|
|
10
|
+
export type IThenShape = any;
|
|
11
|
+
export type InitialState = unknown;
|
|
12
|
+
export type IInput = () => JSX.Element;
|
|
13
|
+
export type ISelection = CElement<any, any>;
|
|
14
|
+
export type IStore = CElement<any, any>;
|
|
15
|
+
export type ISubject = CElement<any, any>;
|
|
16
|
+
|
|
17
|
+
export type ITestImpl<ITestShape extends IBaseTest> =
|
|
18
|
+
ITestImplementation<ITestShape>;
|
|
19
|
+
|
|
20
|
+
export type ITestSpec<ITestShape extends IBaseTest> =
|
|
21
|
+
ITestSpecification<ITestShape>;
|
|
22
|
+
|
|
23
|
+
export const testInterface = {
|
|
24
|
+
beforeEach: async (x, ndx, testRsource, artificer): Promise<IStore> => {
|
|
25
|
+
return new Promise((resolve, rej) => {
|
|
26
|
+
resolve(x());
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
30
|
+
return whenCB(s);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Testeranto from "../../../Node.js";
|
|
2
|
+
import { IBaseTest, IPartialInterface } from "../../../Types";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ITestImpl,
|
|
6
|
+
ITestSpec,
|
|
7
|
+
IInput,
|
|
8
|
+
|
|
9
|
+
testInterface as baseInterface
|
|
10
|
+
} from "./index.js";
|
|
11
|
+
|
|
12
|
+
export default <ITestShape extends IBaseTest>(
|
|
13
|
+
testImplementations: ITestImpl<ITestShape>,
|
|
14
|
+
testSpecifications: ITestSpec<ITestShape>,
|
|
15
|
+
testInput: IInput,
|
|
16
|
+
testInterface: IPartialInterface<ITestShape>,
|
|
17
|
+
) => {
|
|
18
|
+
return Testeranto<
|
|
19
|
+
ITestShape
|
|
20
|
+
>(
|
|
21
|
+
testInput,
|
|
22
|
+
testSpecifications,
|
|
23
|
+
testImplementations,
|
|
24
|
+
{
|
|
25
|
+
...baseInterface,
|
|
26
|
+
...testInterface
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IBaseTest,
|
|
3
|
+
IPartialInterface,
|
|
4
|
+
IPartialWebInterface,
|
|
5
|
+
} from "../../../Types";
|
|
6
|
+
import Testeranto from "../../../Web.js";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ITestImpl,
|
|
10
|
+
ITestSpec,
|
|
11
|
+
IInput,
|
|
12
|
+
testInterface as baseInterface,
|
|
13
|
+
} from "./index.js";
|
|
14
|
+
|
|
15
|
+
export default <ITestShape extends IBaseTest>(
|
|
16
|
+
testImplementations: ITestImpl<ITestShape>,
|
|
17
|
+
testSpecifications: ITestSpec<ITestShape>,
|
|
18
|
+
testInput: IInput,
|
|
19
|
+
testInterface: IPartialWebInterface<ITestShape>
|
|
20
|
+
) => {
|
|
21
|
+
return Testeranto<ITestShape>(
|
|
22
|
+
testInput,
|
|
23
|
+
testSpecifications,
|
|
24
|
+
testImplementations,
|
|
25
|
+
{
|
|
26
|
+
...baseInterface,
|
|
27
|
+
...testInterface,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React, { ReactNode, createElement } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
renderToStaticMarkup,
|
|
4
|
+
renderToStaticNodeStream,
|
|
5
|
+
} from "react-dom/server";
|
|
6
|
+
import Stream from "stream";
|
|
4
7
|
|
|
5
|
-
import
|
|
6
|
-
|
|
8
|
+
import Testeranto from "../../../Node.js";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
IBaseTest,
|
|
12
|
+
ITestImplementation,
|
|
13
|
+
ITestSpecification,
|
|
14
|
+
} from "../../../Types";
|
|
7
15
|
|
|
8
16
|
type IInput = typeof React.Component;
|
|
9
17
|
type InitialState = unknown;
|
|
@@ -13,37 +21,14 @@ export type ISelection = ReactNode;
|
|
|
13
21
|
export type IStore = ReactNode;
|
|
14
22
|
export type ISubject = ReactNode;
|
|
15
23
|
|
|
16
|
-
export {
|
|
17
|
-
renderToStaticMarkup, renderToStaticNodeStream, Stream
|
|
18
|
-
}
|
|
24
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
19
25
|
|
|
20
|
-
export default <ITestShape extends
|
|
21
|
-
testImplementations: ITestImplementation<
|
|
22
|
-
|
|
23
|
-
ISelection,
|
|
24
|
-
IWhenShape,
|
|
25
|
-
IThenShape,
|
|
26
|
-
ITestShape
|
|
27
|
-
>,
|
|
28
|
-
testSpecifications: ITestSpecification<
|
|
29
|
-
ITestShape,
|
|
30
|
-
ISubject,
|
|
31
|
-
IStore,
|
|
32
|
-
ISelection,
|
|
33
|
-
IThenShape
|
|
34
|
-
>,
|
|
26
|
+
export default <ITestShape extends IBaseTest>(
|
|
27
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
28
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
35
29
|
testInput: IInput
|
|
36
30
|
) => {
|
|
37
|
-
return Testeranto<
|
|
38
|
-
ITestShape,
|
|
39
|
-
IInput,
|
|
40
|
-
ISubject,
|
|
41
|
-
IStore,
|
|
42
|
-
ISelection,
|
|
43
|
-
IThenShape,
|
|
44
|
-
IWhenShape,
|
|
45
|
-
InitialState
|
|
46
|
-
>(
|
|
31
|
+
return Testeranto<ITestShape>(
|
|
47
32
|
testInput,
|
|
48
33
|
testSpecifications,
|
|
49
34
|
testImplementations,
|
|
@@ -71,28 +56,23 @@ export default <ITestShape extends ITTestShape>(
|
|
|
71
56
|
resolve(createElement(testInput));
|
|
72
57
|
});
|
|
73
58
|
},
|
|
74
|
-
andWhen: async function (s: IStore,
|
|
75
|
-
|
|
76
|
-
return s
|
|
59
|
+
andWhen: async function (s: IStore, whenCB): Promise<ISelection> {
|
|
60
|
+
return whenCB(s);
|
|
61
|
+
// return s
|
|
77
62
|
},
|
|
78
63
|
butThen: async function (s: IStore): Promise<ISelection> {
|
|
79
64
|
return s;
|
|
80
65
|
},
|
|
81
|
-
afterEach: async function (
|
|
82
|
-
store: IStore,
|
|
83
|
-
ndx,
|
|
84
|
-
artificer
|
|
85
|
-
) {
|
|
66
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
86
67
|
return {};
|
|
87
68
|
},
|
|
88
69
|
afterAll: (store: IStore, artificer) => {
|
|
89
70
|
return;
|
|
90
71
|
},
|
|
91
|
-
}
|
|
92
|
-
)
|
|
72
|
+
}
|
|
73
|
+
);
|
|
93
74
|
};
|
|
94
75
|
|
|
95
|
-
|
|
96
76
|
// type IInput = typeof React.Component;
|
|
97
77
|
// type InitialState = unknown;
|
|
98
78
|
// type IWhenShape = any;
|
|
@@ -142,7 +122,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
142
122
|
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
143
123
|
// });
|
|
144
124
|
// },
|
|
145
|
-
// andWhen: function (s: IStore,
|
|
125
|
+
// andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
146
126
|
// throw new Error(`"andWhens" are not permitted`);
|
|
147
127
|
// }
|
|
148
128
|
// },
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { CElement, createElement } from "react";
|
|
2
|
+
import ReactDom from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
import Testeranto from "../../../Web.js";
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
10
|
+
|
|
11
|
+
type IInput = typeof React.Component;
|
|
12
|
+
type InitialState = unknown;
|
|
13
|
+
type ISelection = {
|
|
14
|
+
htmlElement: HTMLElement;
|
|
15
|
+
reactElement: any; //CElement<any, any>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type IStore = {
|
|
19
|
+
htmlElement: HTMLElement;
|
|
20
|
+
reactElement: any; //CElement<any, any>,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type ISubject = {
|
|
24
|
+
htmlElement: HTMLElement;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default <ITestShape extends IBaseTest, IWhen, IGiven>(
|
|
28
|
+
testInput: IInput,
|
|
29
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
30
|
+
testImplementations: ITestImplementation<ITestShape, any>
|
|
31
|
+
) => {
|
|
32
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
33
|
+
const elem = document.getElementById("root");
|
|
34
|
+
if (elem) {
|
|
35
|
+
class TesterantoComponent extends testInput {
|
|
36
|
+
done: (t: TesterantoComponent) => void;
|
|
37
|
+
constructor(props) {
|
|
38
|
+
super(props);
|
|
39
|
+
this.done = props.done;
|
|
40
|
+
}
|
|
41
|
+
componentDidMount() {
|
|
42
|
+
super.componentDidMount && super.componentDidMount();
|
|
43
|
+
return this.done(this);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return Testeranto<ITestShape>(
|
|
48
|
+
testInput,
|
|
49
|
+
testSpecifications,
|
|
50
|
+
testImplementations,
|
|
51
|
+
{
|
|
52
|
+
beforeAll: async (initialProps, artificer): Promise<ISubject> => {
|
|
53
|
+
console.log("mark5", initialProps);
|
|
54
|
+
return await new Promise((resolve, rej) => {
|
|
55
|
+
const elem = document.getElementById("root");
|
|
56
|
+
if (elem) {
|
|
57
|
+
resolve({ htmlElement: elem });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
beforeEach: async (
|
|
62
|
+
{ htmlElement },
|
|
63
|
+
initializer,
|
|
64
|
+
testResource,
|
|
65
|
+
artificer,
|
|
66
|
+
initialValues
|
|
67
|
+
): Promise<IStore> => {
|
|
68
|
+
return new Promise((resolve, rej) => {
|
|
69
|
+
// console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
|
|
70
|
+
// Ignore these type errors
|
|
71
|
+
ReactDom.createRoot(htmlElement).render(
|
|
72
|
+
createElement(
|
|
73
|
+
TesterantoComponent,
|
|
74
|
+
{
|
|
75
|
+
...initializer,
|
|
76
|
+
done: (reactElement) => {
|
|
77
|
+
resolve({
|
|
78
|
+
htmlElement,
|
|
79
|
+
reactElement,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
[]
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
89
|
+
return whenCB(s);
|
|
90
|
+
},
|
|
91
|
+
butThen: async function (s: IStore): Promise<ISelection> {
|
|
92
|
+
return s;
|
|
93
|
+
},
|
|
94
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
95
|
+
return {};
|
|
96
|
+
},
|
|
97
|
+
afterAll: (store: IStore, artificer) => {
|
|
98
|
+
return;
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
|
|
3
|
+
import Stream from 'stream'
|
|
4
|
+
|
|
5
|
+
import Testeranto from "../../../Node.js";
|
|
6
|
+
import {
|
|
7
|
+
IBaseTest,
|
|
8
|
+
ITestImplementation,
|
|
9
|
+
ITestSpecification
|
|
10
|
+
} from "../../../Types";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
renderToStaticMarkup, renderToStaticNodeStream, Stream
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default <ITestShape extends IBaseTest>(
|
|
17
|
+
|
|
18
|
+
testImplementations: ITestImplementation<ITestShape, any>,
|
|
19
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
20
|
+
testInput: ITestShape['iinput']
|
|
21
|
+
|
|
22
|
+
) => {
|
|
23
|
+
return Testeranto<
|
|
24
|
+
ITestShape
|
|
25
|
+
>(
|
|
26
|
+
testInput,
|
|
27
|
+
testSpecifications,
|
|
28
|
+
testImplementations,
|
|
29
|
+
{
|
|
30
|
+
beforeAll: async (
|
|
31
|
+
prototype,
|
|
32
|
+
artificer
|
|
33
|
+
) => {
|
|
34
|
+
return await new Promise((resolve, rej) => {
|
|
35
|
+
resolve(null);
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
beforeEach: async (
|
|
39
|
+
reactComponent,
|
|
40
|
+
ndx,
|
|
41
|
+
testRsource,
|
|
42
|
+
artificer
|
|
43
|
+
): Promise<ITestShape['istore']> => {
|
|
44
|
+
return new Promise((resolve, rej) => {
|
|
45
|
+
resolve(createElement(testInput));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
andWhen: async function (s, whenCB) {
|
|
49
|
+
return s
|
|
50
|
+
},
|
|
51
|
+
butThen: async function (s: ITestShape['istore']): Promise<ITestShape['iselection']> {
|
|
52
|
+
return s;
|
|
53
|
+
},
|
|
54
|
+
afterEach: async function (
|
|
55
|
+
store: ITestShape['istore'],
|
|
56
|
+
ndx,
|
|
57
|
+
artificer
|
|
58
|
+
) {
|
|
59
|
+
return {};
|
|
60
|
+
},
|
|
61
|
+
afterAll: (
|
|
62
|
+
store: ITestShape['istore'],
|
|
63
|
+
artificer) => {
|
|
64
|
+
return;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
};
|