testeranto 0.49.10 → 0.62.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 +71 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +53 -61
- package/dist/common/Project.js +272 -606
- 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 +5 -14
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -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 -2
- 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 +2 -2
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +32 -0
- package/dist/common/Web.js +41 -112
- package/dist/common/electron.js +188 -44
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +35 -0
- package/dist/common/esbuildConfigs/report.js +48 -0
- package/dist/common/esbuildConfigs/tests.js +14 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/lib/abstractBase.js +193 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/browser.js +26 -0
- package/dist/common/lib/classBuilder.js +41 -0
- package/dist/common/lib/core.js +52 -0
- package/dist/common/lib/index.js +19 -0
- package/dist/common/nodeWriterElectron.js +55 -0
- package/dist/common/preload.js +22 -21
- 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 +53 -61
- package/dist/module/Project.js +272 -583
- 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 +5 -5
- 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 +4 -13
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -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 -2
- 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 +2 -2
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +30 -1
- package/dist/module/Web.js +41 -112
- package/dist/module/electron.js +189 -45
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +30 -0
- package/dist/module/esbuildConfigs/report.js +48 -0
- package/dist/module/esbuildConfigs/tests.js +12 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/lib/abstractBase.js +185 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/browser.js +22 -0
- package/dist/module/lib/classBuilder.js +37 -0
- package/dist/module/lib/core.js +49 -0
- package/dist/module/lib/index.js +15 -0
- package/dist/module/nodeWriterElectron.js +52 -0
- package/dist/module/preload.js +22 -21
- 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 +4 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -27
- 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 → SubPackages}/react-dom/component/node.d.ts +2 -4
- 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/react-test-renderer/component/node.d.ts +9 -0
- 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 +116 -3
- package/dist/types/Web.d.ts +4 -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 +0 -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 +102 -0
- package/dist/types/lib/basebuilder.d.ts +24 -0
- package/dist/types/lib/browser.d.ts +6 -0
- package/dist/types/lib/classBuilder.d.ts +6 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +57 -0
- package/dist/types/nodeWriterElectron.d.ts +2 -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 +120 -85
- package/src/Features.ts +2 -4
- package/src/Node.ts +114 -160
- package/src/NodeWriter.ts +1 -4
- package/src/Project.ts +610 -753
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +46 -0
- package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
- package/src/SubPackages/react/component/web.ts +53 -0
- package/src/SubPackages/react/jsx/index.ts +43 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +28 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
- package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
- package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
- package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
- 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 +334 -3
- package/src/Web.ts +104 -230
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +237 -46
- package/src/esbuildConfigs/features.ts +18 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +59 -0
- package/src/esbuildConfigs/report.ts +51 -0
- package/src/esbuildConfigs/tests.ts +20 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +459 -0
- package/src/lib/basebuilder.ts +253 -0
- package/src/lib/browser.ts +34 -0
- package/src/lib/classBuilder.ts +137 -0
- package/src/lib/core.ts +182 -0
- package/src/lib/index.ts +116 -0
- package/src/nodeWriterElectron.ts +71 -0
- package/src/preload.ts +23 -21
- 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/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/node.d.ts +0 -9
- 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/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/jsx/node.ts +0 -145
- 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/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 { ITestTypes } from "./Types";
|
|
14
|
-
import { TesterantoFeatures } from "./Features";
|
|
13
|
+
import type { ITestTypes } from "./Types";
|
|
14
|
+
import { TesterantoFeatures } from "./Features.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,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Testeranto from "../Node.js";
|
|
4
|
+
|
|
5
|
+
import { IBaseTest, IPartialInterface, ITestImplementation, ITestSpecification } from "../Types";
|
|
6
|
+
|
|
7
|
+
type IInput = string;
|
|
8
|
+
type ISelection = any;
|
|
9
|
+
type IStore = any
|
|
10
|
+
type ISubject = any
|
|
11
|
+
|
|
12
|
+
export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec, object>
|
|
13
|
+
|
|
14
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
15
|
+
|
|
16
|
+
export default <ITestShape extends IBaseTest>(
|
|
17
|
+
testInput: IInput,
|
|
18
|
+
testSpecifications: ISpec<ITestShape>,
|
|
19
|
+
testImplementations: ITestImplementation<ITestShape, object>,
|
|
20
|
+
testInterface?: IPartialInterface<ITestShape>
|
|
21
|
+
) => {
|
|
22
|
+
return Testeranto<ITestShape>(
|
|
23
|
+
testInput,
|
|
24
|
+
testSpecifications,
|
|
25
|
+
testImplementations,
|
|
26
|
+
{
|
|
27
|
+
beforeAll(x) {
|
|
28
|
+
process.parentPort.postMessage(`/dist/web/src/ClassicalComponent/test.html`)
|
|
29
|
+
|
|
30
|
+
return x;
|
|
31
|
+
},
|
|
32
|
+
beforeEach: async (
|
|
33
|
+
): Promise<IStore> => {
|
|
34
|
+
return new Promise((resolve, rej) => {
|
|
35
|
+
resolve(React.createElement(testInput, {
|
|
36
|
+
}, []));
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
40
|
+
return whenCB()(s);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
...testInterface
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import Testeranto from "../../../Node";
|
|
3
|
+
import Testeranto from "../../../Node.js";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
type IThenShape = any;
|
|
5
|
+
import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
|
|
8
6
|
|
|
9
7
|
type IInput = typeof React.Component;
|
|
10
8
|
type ISelection = React.CElement<any, any>
|
|
@@ -12,49 +10,31 @@ type IStore = React.CElement<any, any>
|
|
|
12
10
|
type ISubject = React.CElement<any, any>
|
|
13
11
|
|
|
14
12
|
export type IImpl<
|
|
15
|
-
ISpec extends
|
|
13
|
+
ISpec extends IBaseTest,
|
|
16
14
|
IState
|
|
17
15
|
> = ITestImplementation<
|
|
18
|
-
|
|
19
|
-
ISelection,
|
|
20
|
-
IWhenShape,
|
|
21
|
-
IThenShape,
|
|
22
|
-
ISpec
|
|
16
|
+
ISpec, object
|
|
23
17
|
>
|
|
24
18
|
|
|
25
19
|
export type ISpec<
|
|
26
|
-
T extends
|
|
20
|
+
T extends IBaseTest
|
|
27
21
|
> = ITestSpecification<
|
|
28
|
-
T
|
|
29
|
-
ISubject,
|
|
30
|
-
IStore,
|
|
31
|
-
ISelection,
|
|
32
|
-
IThenShape
|
|
22
|
+
T
|
|
33
23
|
>;
|
|
34
24
|
|
|
35
25
|
export default <
|
|
36
|
-
ITestShape extends
|
|
26
|
+
ITestShape extends IBaseTest,
|
|
37
27
|
IState
|
|
38
28
|
>(
|
|
39
29
|
testImplementations: ITestImplementation<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
IWhenShape,
|
|
43
|
-
IThenShape,
|
|
44
|
-
ITestShape
|
|
30
|
+
ITestShape,
|
|
31
|
+
object
|
|
45
32
|
>,
|
|
46
33
|
testSpecifications: ISpec<ITestShape>,
|
|
47
34
|
testInput: IInput
|
|
48
35
|
) => {
|
|
49
36
|
return Testeranto<
|
|
50
|
-
ITestShape
|
|
51
|
-
IInput,
|
|
52
|
-
ISubject,
|
|
53
|
-
IStore,
|
|
54
|
-
ISelection,
|
|
55
|
-
IThenShape,
|
|
56
|
-
IWhenShape,
|
|
57
|
-
IState
|
|
37
|
+
ITestShape
|
|
58
38
|
>(
|
|
59
39
|
testInput,
|
|
60
40
|
testSpecifications,
|
|
@@ -67,8 +47,8 @@ export default <
|
|
|
67
47
|
}, []));
|
|
68
48
|
});
|
|
69
49
|
},
|
|
70
|
-
andWhen: function (s: IStore,
|
|
71
|
-
return
|
|
50
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
51
|
+
return whenCB()(s);
|
|
72
52
|
},
|
|
73
53
|
},
|
|
74
54
|
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Testeranto from "../../../Web.js";
|
|
4
|
+
|
|
5
|
+
import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
|
|
6
|
+
|
|
7
|
+
type IInput = typeof React.Component;
|
|
8
|
+
type ISelection = React.CElement<any, any>
|
|
9
|
+
type Store = React.CElement<any, any>
|
|
10
|
+
type Subject = React.CElement<any, any>
|
|
11
|
+
|
|
12
|
+
export type IImpl<
|
|
13
|
+
ISpec extends IBaseTest,
|
|
14
|
+
IState
|
|
15
|
+
> = ITestImplementation<
|
|
16
|
+
ISpec, object
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
export type ISpec<
|
|
20
|
+
T extends IBaseTest
|
|
21
|
+
> = ITestSpecification<
|
|
22
|
+
T
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export default <
|
|
26
|
+
ITestShape extends IBaseTest,
|
|
27
|
+
>(
|
|
28
|
+
testImplementations: ITestImplementation<
|
|
29
|
+
ITestShape, object
|
|
30
|
+
>,
|
|
31
|
+
testSpecifications: ISpec<ITestShape>,
|
|
32
|
+
testInput: IInput
|
|
33
|
+
) => {
|
|
34
|
+
return Testeranto<
|
|
35
|
+
ITestShape
|
|
36
|
+
>(
|
|
37
|
+
testInput,
|
|
38
|
+
testSpecifications,
|
|
39
|
+
testImplementations,
|
|
40
|
+
{
|
|
41
|
+
beforeEach: async (
|
|
42
|
+
): Promise<Store> => {
|
|
43
|
+
return new Promise((resolve, rej) => {
|
|
44
|
+
resolve(React.createElement(testInput, {
|
|
45
|
+
}, []));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
andWhen: function (s: Store, whenCB): Promise<ISelection> {
|
|
49
|
+
return whenCB()(s);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CElement } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
IBaseTest, ITestImplementation, ITestSpecification
|
|
5
|
+
} from "../../../Types";
|
|
6
|
+
|
|
7
|
+
export type IWhenShape = any;
|
|
8
|
+
export type IThenShape = any;
|
|
9
|
+
export type InitialState = unknown;
|
|
10
|
+
export type IInput = () => JSX.Element;
|
|
11
|
+
export type ISelection = CElement<any, any>
|
|
12
|
+
export type IStore = CElement<any, any>
|
|
13
|
+
export type ISubject = CElement<any, any>
|
|
14
|
+
|
|
15
|
+
export type ITestImpl<
|
|
16
|
+
ITestShape extends IBaseTest
|
|
17
|
+
> = ITestImplementation<
|
|
18
|
+
ITestShape, object
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
export type ITestSpec<
|
|
22
|
+
ITestShape extends IBaseTest
|
|
23
|
+
> = ITestSpecification<
|
|
24
|
+
ITestShape
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
export const testInterface = {
|
|
28
|
+
|
|
29
|
+
beforeEach: async (
|
|
30
|
+
x,
|
|
31
|
+
ndx,
|
|
32
|
+
testRsource,
|
|
33
|
+
artificer
|
|
34
|
+
): Promise<IStore> => {
|
|
35
|
+
return new Promise((resolve, rej) => {
|
|
36
|
+
resolve(x())
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
40
|
+
return whenCB(s);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
}
|
|
@@ -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,28 @@
|
|
|
1
|
+
import { IBaseTest, IPartialInterface } from "../../../Types";
|
|
2
|
+
import Testeranto from "../../../Web.js";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ITestImpl,
|
|
6
|
+
ITestSpec,
|
|
7
|
+
IInput,
|
|
8
|
+
testInterface as baseInterface
|
|
9
|
+
} from "./index.js";
|
|
10
|
+
|
|
11
|
+
export default <ITestShape extends IBaseTest>(
|
|
12
|
+
testImplementations: ITestImpl<ITestShape>,
|
|
13
|
+
testSpecifications: ITestSpec<ITestShape>,
|
|
14
|
+
testInput: IInput,
|
|
15
|
+
testInterface: IPartialInterface<ITestShape>
|
|
16
|
+
) => {
|
|
17
|
+
return Testeranto<
|
|
18
|
+
ITestShape
|
|
19
|
+
>(
|
|
20
|
+
testInput,
|
|
21
|
+
testSpecifications,
|
|
22
|
+
testImplementations,
|
|
23
|
+
{
|
|
24
|
+
...baseInterface,
|
|
25
|
+
...testInterface
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
};
|
|
@@ -2,8 +2,9 @@ import React, { ReactNode, createElement } from "react";
|
|
|
2
2
|
import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
|
|
3
3
|
import Stream from 'stream'
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import Testeranto from "../../../Node.js";
|
|
6
|
+
|
|
7
|
+
import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
|
|
7
8
|
|
|
8
9
|
type IInput = typeof React.Component;
|
|
9
10
|
type InitialState = unknown;
|
|
@@ -17,32 +18,17 @@ export {
|
|
|
17
18
|
renderToStaticMarkup, renderToStaticNodeStream, Stream
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export default <ITestShape extends
|
|
21
|
+
export default <ITestShape extends IBaseTest>(
|
|
21
22
|
testImplementations: ITestImplementation<
|
|
22
|
-
|
|
23
|
-
ISelection,
|
|
24
|
-
IWhenShape,
|
|
25
|
-
IThenShape,
|
|
26
|
-
ITestShape
|
|
23
|
+
ITestShape, object
|
|
27
24
|
>,
|
|
28
25
|
testSpecifications: ITestSpecification<
|
|
29
|
-
ITestShape
|
|
30
|
-
ISubject,
|
|
31
|
-
IStore,
|
|
32
|
-
ISelection,
|
|
33
|
-
IThenShape
|
|
26
|
+
ITestShape
|
|
34
27
|
>,
|
|
35
28
|
testInput: IInput
|
|
36
29
|
) => {
|
|
37
30
|
return Testeranto<
|
|
38
|
-
ITestShape
|
|
39
|
-
IInput,
|
|
40
|
-
ISubject,
|
|
41
|
-
IStore,
|
|
42
|
-
ISelection,
|
|
43
|
-
IThenShape,
|
|
44
|
-
IWhenShape,
|
|
45
|
-
InitialState
|
|
31
|
+
ITestShape
|
|
46
32
|
>(
|
|
47
33
|
testInput,
|
|
48
34
|
testSpecifications,
|
|
@@ -71,9 +57,9 @@ export default <ITestShape extends ITTestShape>(
|
|
|
71
57
|
resolve(createElement(testInput));
|
|
72
58
|
});
|
|
73
59
|
},
|
|
74
|
-
andWhen: async function (s: IStore,
|
|
75
|
-
|
|
76
|
-
return s
|
|
60
|
+
andWhen: async function (s: IStore, whenCB): Promise<ISelection> {
|
|
61
|
+
return whenCB(s);
|
|
62
|
+
// return s
|
|
77
63
|
},
|
|
78
64
|
butThen: async function (s: IStore): Promise<ISelection> {
|
|
79
65
|
return s;
|
|
@@ -142,7 +128,7 @@ export default <ITestShape extends ITTestShape>(
|
|
|
142
128
|
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
143
129
|
// });
|
|
144
130
|
// },
|
|
145
|
-
// andWhen: function (s: IStore,
|
|
131
|
+
// andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
146
132
|
// throw new Error(`"andWhens" are not permitted`);
|
|
147
133
|
// }
|
|
148
134
|
// },
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { CElement, createElement } from "react";
|
|
2
2
|
import ReactDom from "react-dom/client";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import Testeranto from "../../../Web.js";
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification
|
|
9
|
+
} from "../../../Types";
|
|
6
10
|
|
|
7
11
|
type IInput = typeof React.Component;
|
|
8
12
|
type InitialState = unknown;
|
|
9
|
-
type IWhenShape = any;
|
|
10
|
-
type IThenShape = any;
|
|
11
13
|
type ISelection = {
|
|
12
14
|
htmlElement: HTMLElement,
|
|
13
15
|
reactElement: CElement<any, any>,
|
|
@@ -22,26 +24,22 @@ type ISubject = {
|
|
|
22
24
|
htmlElement: HTMLElement
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export default <
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
export default <
|
|
28
|
+
ITestShape extends IBaseTest,
|
|
29
|
+
IWhen,
|
|
30
|
+
IGiven
|
|
31
|
+
>(
|
|
32
|
+
testInput: IInput,
|
|
33
|
+
testSpecifications: ITestSpecification<
|
|
31
34
|
ITestShape
|
|
32
35
|
>,
|
|
33
|
-
|
|
36
|
+
testImplementations: ITestImplementation<
|
|
34
37
|
ITestShape,
|
|
35
|
-
|
|
36
|
-
IStore,
|
|
37
|
-
ISelection,
|
|
38
|
-
IThenShape
|
|
38
|
+
any
|
|
39
39
|
>,
|
|
40
|
-
testInput: IInput
|
|
41
|
-
) => {
|
|
42
40
|
|
|
41
|
+
) => {
|
|
43
42
|
document.addEventListener("DOMContentLoaded", function () {
|
|
44
|
-
console.log("DOMContentLoaded")
|
|
45
43
|
const elem = document.getElementById("root");
|
|
46
44
|
if (elem) {
|
|
47
45
|
class TesterantoComponent extends testInput {
|
|
@@ -57,23 +55,17 @@ export default <ITestShape extends ITTestShape>(
|
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
return Testeranto<
|
|
60
|
-
ITestShape
|
|
61
|
-
IInput,
|
|
62
|
-
ISubject,
|
|
63
|
-
IStore,
|
|
64
|
-
ISelection,
|
|
65
|
-
IThenShape,
|
|
66
|
-
IWhenShape,
|
|
67
|
-
InitialState
|
|
58
|
+
ITestShape
|
|
68
59
|
>(
|
|
69
60
|
testInput,
|
|
70
61
|
testSpecifications,
|
|
71
62
|
testImplementations,
|
|
72
63
|
{
|
|
73
64
|
beforeAll: async (
|
|
74
|
-
|
|
65
|
+
initialProps,
|
|
75
66
|
artificer
|
|
76
67
|
): Promise<ISubject> => {
|
|
68
|
+
console.log("mark5", initialProps);
|
|
77
69
|
return await new Promise((resolve, rej) => {
|
|
78
70
|
const elem = document.getElementById("root");
|
|
79
71
|
if (elem) {
|
|
@@ -84,14 +76,17 @@ export default <ITestShape extends ITTestShape>(
|
|
|
84
76
|
},
|
|
85
77
|
beforeEach: async (
|
|
86
78
|
{ htmlElement },
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
artificer
|
|
79
|
+
initializer,
|
|
80
|
+
testResource,
|
|
81
|
+
artificer,
|
|
82
|
+
initialValues
|
|
90
83
|
): Promise<IStore> => {
|
|
91
84
|
return new Promise((resolve, rej) => {
|
|
85
|
+
// console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
|
|
92
86
|
// Ignore these type errors
|
|
93
87
|
ReactDom.createRoot(htmlElement).render(createElement(
|
|
94
88
|
TesterantoComponent, {
|
|
89
|
+
...initializer.props,
|
|
95
90
|
done: (reactElement) => {
|
|
96
91
|
resolve(
|
|
97
92
|
{
|
|
@@ -104,8 +99,8 @@ export default <ITestShape extends ITTestShape>(
|
|
|
104
99
|
));
|
|
105
100
|
});
|
|
106
101
|
},
|
|
107
|
-
andWhen: function (s: IStore,
|
|
108
|
-
return
|
|
102
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
103
|
+
return whenCB(s);
|
|
109
104
|
},
|
|
110
105
|
butThen: async function (s: IStore): Promise<ISelection> {
|
|
111
106
|
return s;
|
|
@@ -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
|
+
};
|